mongodbgeospatialpolygonpostgissrid

MongoDB spatial query for Polygons


I will build a GIS system based on polygons, not just points. I wanted to use MongoDB or PostGIS.

How do this in MongoDB?

enter image description here

Query A - get the center of a polygon

Query B - distance between two polygons

Query C - list of polygons that are part of a third that I specify

Query D - near-distance of the polygon

Support SRID?


Solution

  • MongoDB's geospatial indexing currently only indexes points. Although it does support proximity and bounds queries, documents are matched by a single point. You may be able to take advantage of multi-location documents and index multiple points along a polygon, which might support some of your queries with reduced precision; however, that would certainly not be ideal.

    PostGIS seems more appropriate for your requirements.