Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question
Also, take a look at… – om_henners Aug 29 '12 at 6:36
up vote 4 down vote accepted

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.).

share|improve this answer

I think postgis will be a better bet at this stage.

Query A: use ST_Centroid

Query B: use ST_Distance

Query C: not sure what logic you are applying, but probably something like ST_Intersects. Read up on the 9 intersection model if this doesn't do what you were expecting.

Query D: I think you want ST_Distance again. Please explain further if that doesn't do what you were expecting.

share|improve this answer
I want to select all polygons that intersect with another polygon as parameter – Ciro Vargas Sep 18 '12 at 22:25
my parameter is C and i can get the polygon A and polygon B – Ciro Vargas Sep 18 '12 at 22:26
So ST_Intersects should do you what you want. I still recommend reading up on the intersection model. – BradHards Sep 19 '12 at 5:29
see my problem… – Ciro Vargas Sep 19 '12 at 17:46
For D I'd use ST_DWithin in PostGIS – Pimin Konstantin Kefaloukos Jun 19 '13 at 9:02

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.