Monday, February 27, 2012

Re: Is GeoDjango Too Much For This?


What a generous answer. Thank you so much. Here are my responses with
a few other questions:

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

I'm on a Mac. The Django GeoDjango installation instructions are
somewhat obtuse and there aren't alternative sites I've found with
more straightforward instructions. It's lame that these are confusing
but, well, they are. I will no doubt review the sites you recommended.

As a newcomer who suddenly feels he may be biting off more than he can
chew, one of my worries it that if I utilize the sqlite3 database for
development with Spatialite, when I finally deploy this to, say, a
Postgres database, it won't transition correctly. This is most likely
due to my naiveté about databases, but I'm just concerned once it's
deployed, it won't work because I screwed something up by using
sqlite3 and I'm now trying to use another type of database.

From your textbook descriptions (awesome) it seems that GeoIP is what
I'm looking for. Essentially, a logged-in user's coordinates would be
taken from their IP address (not sure if GeoDjango has a way to do
this without front-end JS work (more terror)) and be able to identify
their location on, let's say, a Google Map. When the user posts
content, it would be identified and recorded in the database the same
way. So if they're in a new location, the application can detect where
they are through the IP address and record those coordinates in the
database. This content could then be sorted via location (e.g., find
posts within a 10 mile radius), perhaps through a search or maybe
through a map with markers.

The problem with using HTML5 is, while it seems easy (there's pre-
formatted code out there that makes it a cinch to identify IP
location), it really provides no simple way to store or search for
content that's identified via GeoIP.

So, from reading your finely detailed response, it seems a valid and
straightforward way to proceed would be:

- GeoDjango using the GeoIP features
- OpenLayers (have heard about it; need to research more)
- Google Maps or another mapping service, being wary of limits

From what I can discern, this is not an extremely advanced use of
GeoDjango or geolocation in general. It may actually be simple. But
I'm just now getting over my fears of Django proper so GeoDjango seems
like jumping from the kiddie pool into deep-dea diving. Another person
who responded focused his very kind and generous response on having to
be adept at trig to make GeoDjango work. I've avoided trig since I was
14. What have I gotten into? :)

Your response, again, was awesome. Any more guidance is not only
appreciated, but welcomed.

What a great and kind resource this forum is.

On Feb 27, 11:57 am, Ethan Jucovy <> wrote:
> On Sat, Feb 25, 2012 at 7:50 PM, DF <> 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
> [1]
> [2]
> [3]
> [4]
> [5]
> [6]
> [7]
> [8]
> [9]
> [10]

You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to
To unsubscribe from this group, send email to
For more options, visit this group at

No comments:

Post a Comment