5

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?

4

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

2

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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