Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GIS application with django and google maps using mongodb

I am developing a gis application using Google maps API. Currently I am using Postgis db.

I am considering switching to mongodb and I have following questions about this,

  1. Is mongodb a viable choice for storing GIS data. ( Is any other NoSQL engine viable?)

  2. Does django-nonrel has modified django.contrib.gis module for mongodb support? and how well does it work?

Thanks in advance :)

like image 218
sarveshseri Avatar asked Jan 16 '12 13:01

sarveshseri


3 Answers

As stated by Sergio Tulentsev, MongoDB has spatial indexes. But, not all geometry types can be stored. As far as I know, currently only points can be stored. You can, however, query using a polygon.

Since MongoDB is very flexible, you could store geometry as a text, but also as a JSON object. For example, you could store a coordinate like: { lon: 52.1234, lat: 14.1245 }. You can interpret this is on your own application as you like.

The downside to this is that there is no native index. If you never have to query based on location/spatial relation, you are fine. If you do have query based on location/spatial relation, you would have to write your own index. Can be a hard thing do...

There is CouchDB which has a GeoSpatial addition. Don't know how it works/what it supports though.

A hybrid approach is also often taken by some large-data-based companies. For example, use MongoDB to store/query normal data, and PostGIS to store/query geospatial data.

like image 172
StevenLooman Avatar answered Nov 11 '22 06:11

StevenLooman


Django MongoDB Engine developer here.

We haven't got any sort of real support for MongoDB's GIS features. It's possible to do geospatial queries by "working around Django" though (see http://django-mongodb.org/topics/lowerlevel.html - the first example is actually about Geo indexes).

It should be possible, however, to implement native Django GIS support into the MongoDB backend. We're really happy to mentor anyone who wants to approach that task!

like image 35
Jonas H. Avatar answered Nov 11 '22 05:11

Jonas H.


I've been working with MongoDb storing points of interest in the DB, then doing point in poly queries, along with radius queries and Mongo has been FAR superior to PostGres. I've had much faster response times with hundreds of thousands of items.

I would say however depending on the complexity of your queries (ie if you're doing something beyond point in poly, radius around a point), you might want a more heavy GIS db like postgres.. you're just going to get the extra weight of postgres as well.

Sorry I can't speak to anything on django as well.

like image 3
Petrogad Avatar answered Nov 11 '22 05:11

Petrogad