Python and Django have re-inspired my lust for programming! Here is a list of all the Geo programming resources for Python that I could find. If I’ve missed something good, please let me know in the comments.
GeoDjango
GeoDjango is the GIS branch of Django, it is designed to work with geographic models and provide geographic functionality.
Maxmind offer GeoIP databases which provide geolocation of IP addresses.
This snippet provides GeoDjango models for the database; this little snippet will import it from csv.
Django Trunk
If you’re working with Django trunk, there are also plenty of snippets worth knowing about:
This Django snippet renders a form field with a map from Google maps, users can drag a pin to a point and the lat,long is captured in a hidden field.
This Django snippet is similar, it generates Lat and Long in separate fields.
This Django template tag displays a Google Map.
Django-Geo is a reusable geo-tagging application. It allows you geo tag any object in your database. I am unclear how mature this is but from the authors blog it appears ready for use now.
Python in General
For starters, there’s a GIS section in the Cheeseshop (Thanks Sean).
Geopy - A cool swiss-army Geolocation toolkit. Locate the coordinates of addresses, cities, countries, and landmarks across the globe using third-party geocoders (Google, Yahoo… etc) and other sources of data, such as wikis.
Or use this simple Google only geocoding snippet.
Everyblock ingeniously designed their own mapping engine from scratch.
For databases, we have PostGIS and also the MySQL spacial extentions.
Did I miss something?
Am sure this list is far from complete. Please let me know if I’ve missed something out…
The GeoIP snippets were just a proof of concept and seriously need some optimization. GeoDjango has a direct interface to the GeoIP library that is significantly faster and easier to use than those snippets.