Monday, February 27, 2012

Re: Is GeoDjango Too Much For This?

On Sat, Feb 25, 2012 at 7:50 PM, DF <donfernandez@gmail.com> wrote:
GeoDjango though, to be honest, sounds frightening and extremely
advanced. I've been reviewing the installation requirements and, at
least according to how these were written, is intense and ripe for
many errors.

What is your operating system?  On Ubuntu I've found all the installation to be very easy.

FWIW, when I was starting out with GeoDjango I found these tutorials to be useful -- they're written for specific OSes/distributions/database backends but I still found them easier to follow than the official documentation: [1,2,3]
 
Part of the qualms I'm having is I've been developing on
the internal sqlite3 database. According to most of the documentation,
Postgres with GIS is recommended. This is concerning.

I haven't used the spatial extensions to SQLite (SpatiaLite) but I believe SpatiaLite is fully supported by GeoDjango and has all the features you will need.  (As long as the features you need don't include multiple users writing to the database at the same time!  For production you will probably want Postgres instead of Sqlite, for reasons that have nothing to do with GIS.)
 
Essentially, I want to be able to have the application immediately
detect a users longitude and latitude and have all the content they
contribute be identified with those coordinates.

Depending what you mean by "immediately detect", you'll want to look into "geocoding" and/or "GeoIP" and/or the W3C/HTML5 "geolocation API".

Geocoding is the process of translating a text address into a lat/long, e.g. when an end-user types in his address in order to center a map there.  GeoDjango doesn't provide any direct geocoding features, but it's easy to implement in your GeoDjango-based application.  You'll most likely want to use a web service for this -- Google, Yahoo, and many other services (including some that are free software) exist.  Pay attention to the terms of use when picking a service: some (*coughGooglecough*) are actually very restrictive if you read the fine print.  Once you've picked your service, libraries like [4] or [5] will do most of the rest of the work for you.

GeoIP lets you infer a user's location based on his IP address when he visits your application.  GeoDjango does provide GeoIP features: [6]
 
The W3C Geolocation API is an HTML5 standard that lets the client browser provide the user's location directly in Javascript, if the client device knows it and the user gives permission.  Since this is a client-side feature, GeoDjango doesn't provide any support for it directly; you'd just write your HTML and Javascript to use it: [7,8]

I'd like a map illustrating their location to appear with each content post.

You'll want a web mapping frontend for this.  GeoDjango doesn't provide a web mapping frontend itself, but (like geocoding) it is easy to implement one in your application once you have lat/longs.  OpenLayers (which is free software) and Google Maps are the established tools here, and now there are a number of newer ones too -- which I've never tried out.  (Once again though pay attention to the terms of use.)
 
Finally, I want to provide users the ability to search for nearby posts or
within a certain boundary (from the documentation I've read, this is
what GeoDjango apparently excels at).

That's exactly right.  Note that in certain sufficiently constrained circumstances you could accomplish this without spatial queries in a database.  If you only need your users to see nearby posts, and the total number of posts is small enough, you could load all posts on a map and do the "search" via client-side geocoding APIs and re-centering your map.  This obviously doesn't scale well, and if you need these sorts of features in a "non-superficial" way then saving geolocated data and building queries through GeoDjango's ORM APIs [9,10] is exactly what you'll want.

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.

No comments:

Post a Comment