[GIS] How to perform spatial queries on polygons in mongodb

mongodbnosqlpolygon

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?

Best Answer

Currently MongoDB does not support these spatial operations - only Geospatial Indexing of 2d points is supported with some basic accompanying queries (near, within). If you need them you would need to develop support from scratch. Hopefully in the future this will be included.

However if you are interested in storing spatial data in a NoSQL database (instead of a standard relational database, such as PostGIS) you could try CouchDB with the geocouch extension. Geocouch uses GeoJSON to store geometry so polygons can be stored. However as far as I can see only boundnig box queries are supported so far - which you could use to narrow your search - with hopefully polygon and radius search, and srs support coming soon. (Also, a tutorial that I found from Todd Jackson gives a good run-through on getting started. And see this question on GIS SE.).

Related Question