Saturday, February 25, 2012

Re: Is GeoDjango Too Much For This?

Others have answered your other questions well, so just addressing this one:

On Thu, Feb 23, 2012 at 8:13 PM, DF <donfernandez@gmail.com> wrote:
Essentially, I'm looking to see what benefits GeoDjango would give
this project over using just the Google Maps API. If I've already
started a project in basic Django, is incorporating GeoDjango
problematic?  I'm still attempting to master the basics of Django and
venturing into GeoDjango may be too much. Or not.

I've added GeoDjango to existing "base Django" projects before, including one where the codebase was already storing lat/lon data in FloatFields and I had to migrate.  Short answer: it's really easy.  You just add django.contrib.gis to INSTALLED_APPS and add a few more well documented settings -- just like adding any other app into your project.

There are just two points where you need to pay close attention to the docs or else you'll get confusing errors:

* You'll need to change the ENGINE setting on your DATABASE(s) settings -- just replace the default Django ENGINEs with the appropriate one from this list: https://docs.djangoproject.com/en/dev/ref/contrib/gis/db-api/#spatial-backends

* You'll want to add a line ``objects = GeoManager`` on each model that you will want to perform geospatial queries against.  This includes models with no direct geospatial data if they have relations to GIS models, that is if you want to be able to query them against geospatial properties on their relations.

The only other caution is setting up your geospatial database.  If you're using MySQL no extra work is needed, because it's all built in, but you'll get very few features -- MySQL has limited GIS support.  If you're using Postgres or SQLite you'll be able to use all the Geodjango features, but you'll need to set up your database for it in advance.  If you already have a Postgres or SQLite database with data you want to keep it will be a little extra work to migrate it over to a geospatial database.

Hope this helps,
Ethan

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate