Tuesday, July 23, 2013

Spatial indexing in mongodb

I don't really know when it was, added to mongodb, but it seems that not only mongo supports more geometry types now, but it also supports spherical calculation of predicates (intersection, inclusion, distance) on spatial data:
http://docs.mongodb.org/manual/core/geospatial-indexes/

The supported types (as of now) are:

  • point
  • linestring
  • polygon
So for any composite geometries (multi-* or heteregenious collections) you would need to have a 1:many relationship and index on geometry parts. Since mongo supports only intersection and inclusion as predicates, these also work well for the parts (if a part of geometry intersects predicate, the full geometry also does; if all parts of geometry are included, full geometry is included), it seems that it is a good fit for a large part of GIS applications. 

No comments:

Post a Comment