I am trying to select a backend for a geo enabled website written in Django.

Is MongoDB an easy possibility or stick with PostGIS?

What are the key considerations to choose one or the other if yes?

I can't find information on the web to help with this question.

closed as too broad by BradHards, Jay Cummins, Mike T, PolyGeo Dec 6 '14 at 5:02

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 4
    "It depends". You have to tell us more about exactly what you need the database for to get any kind of useful answer. Without those details, your question is too broad to be answered, and will likely be closed. What have you looked at? What operations to do you need? How much data? What kind of data? – BradHards Aug 20 '14 at 2:05

I'm using both, each for its own purpose.

I believe that most simple filtering queries you can make on PostGis have an equivalent on MongoDB (within, near, intersection). MongoDB has the additional advantage of being capable to ingest a sparse schema and nested properties (sure, pg can do this too, but you need to k ow beforehand which properties you will store as json). If you want to store the results of an api call to twitter or google places, you just need to identify the id and location fields and save the results as a document. No need to cast the geometry as it happens in PostGIS because it usually comes as geojson already.

However, if you're planning on performing any operation on geometries such as finding centroids, doing douglas peucker simplification, union, etc, you can't do that in mongo. Working with any srid different from 4326 (WGS84) you can't do in mongo. Aggregation is doable but not trivial.

Finally, postGIS offloads the burden of many operations to Geos and Gdal, which are proven tools that specialize in their tasks. MongoDB in turn performs its geo queries using its own logic. I'm sure mongo has amazing engineers, but it's a bit like reinventing the wheel.

  • There is talk of adding GEOS to mongo. Also see ksomb on postgres for proper indexed json datatype – John Powell Oct 7 '14 at 5:13
  • You mean... GIST indexes over json subfields? – amenadiel Oct 7 '14 at 10:54
  • Sorry, I mispelt my comment, that should have been jsonb. Acually, no, gin indexes, postgresql.org/docs/9.4/static/datatype-json.html, which are better for text search. But, with jsonb indexing and gist indexes on geometry, Postgres offers more than MongoDB, imho, at least in the spatial world. – John Powell Oct 7 '14 at 11:04

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