Context Navigation

What's GIS?

​Series of blog posts giving intro to GIS; choice quote from ​an early post: "If you feel like ending a conversation with a developer then simply bring up the topic of character encodings ... [o]r ... coordinate systems. ... So in the spirit of Tim Bray's and Joel Spolsky's wonderful writeups of character encodings, I thought I'd put together a basic survival guide to coordinate systems over my next few posts and then tie it back to Google Maps."

Has a Python interface. A SWIG interface is in development, but not yet stable (no access to full API).

​Geo::Coder::US An excellent Perl library for GeoCoding that powers ​Geocoder.us. Users can create their own Geographic databases using the Census Bureau's TIGER/Line data (see below).

​GeoRosetta, CC-BY-SA licensed, quality-controlled, collection of geocoding data. Not yet released to public(?).

​MapServer: University of Minnesota (UMN) "open source development environment for building spatially-enabled internet applications."

​MapNik: C++ and Python toolkit for developing mapping applications. Claimed benefits over MapServer: "It uses the AGG library and offers world class anti-aliasing rendering with subpixel accuracy for geographic data. It is written from scratch in modern C++ and doesn't suffer from design decisions made a decade ago." See​MapNik FAQ.

​Spatial Adapter for Rails: A plugin for Rails which manages the MySql Spatial and PostGIS geometric columns in a transparent way (that is like the other base data type columns). This might have some useful techniques for when we try to support other spatial extensions other than PostGIS.

Useful Data

​TIGER/Line: "The TIGER/Line files are extracts of selected geographic and cartographic information from the ​Census Bureau's TIGER® (Topologically Integrated Geographic Encoding and Referencing) database." This data is useful in creating your own geocoding database service. Currently 2006 First Edition is the latest, but second edition should be coming soon. Note: The Census Bureau will be ​providing SHP files in Fall, 2007.

Questions

When dealing with points (say, degrees) from, do they need to be converted to be useful on the back-end data, assuming -that- data is in degrees? Is it enough to have the same datum and origin? (Reading the intro above is likely to answer the question.)

My (JDunck) reading indicates yes. Given the same coordinate system (i.e. datum, origin, and axes), degrees are useful without conversion.

Implementation

Phase 1

Create Geometry-enabled fields and manager. Status: complete as of r4788.

PostGIS additions to the API may now be used. Geographic queries are done by calling geo_filter() and geo_exclude on geometry-enabled models. In the following example, the bbcontains lookup type is used which is the same as the PostGIS && operator. It looks to see if the bounding box of the polygon contains the specific point. The next example uses the PostGIS Contains() function, which calls GEOS library to test for actual intersection of the two geometries, not just the bounding box.

Both geo_filter() and filter() may be used in the same query. For example, the following query set will only show school districts that have 'Houston' in their name and contain the given point within their polygon boundary:

Phase 2

Contemplate a JS framework for mapping. I know Django community is against including any type of JS/AJAX framework, but having a way to generate maps would be a great addition. Also, any type of framework would be limited to the contrib package only.

Installation

Installation of the GeoDjango module will also require the installation of existing open source geographic libraries and a spatial database (currently only PostGIS). This section will describe the installation process for these libraries. Initially, these instructions will pertain only to a Linux platform (particularly Debian or Ubuntu). Mac & Windows support will be considered later; however, these instructions will most likely work through the Mac shell. Don't hold your breath for Windows support.

GDAL

Latest GDAL version is 1.4.0. Configure with GEOS and Python support, then make and install:

$ ./configure --with-geos --with-python
$ make
# make install

Note: This is done without the 'next generation' SWIG Python bindings. I've had trouble getting them to work, and the rumor is this only works on Windows. The compilation flag to enable these is --with-ngpython, but our packages currently only use the old bindings.