Code

Changes between Version 80 and Version 81 of GeoDjango


Ignore:
Timestamp:
06/04/07 21:23:58 (7 years ago)
Author:
jbronn
Comment:

updated implementation, windows install, gdal install, and some links

Legend:

Unmodified
Added
Removed
Modified
  • GeoDjango

    v80 v81  
    11[[TOC(GeoDjangoBackground, GeoDjango, GeoDjangoModelAPI, GeoDjangoDatabaseAPI)]] 
    22The [http://code.djangoproject.com/browser/django/branches/gis GIS] branch intends to be a world-class geographic web framework.  Our goal is to make it as easy as possible to build GIS web applications and harness the power of spatially enabled data. 
     3 
     4'''Note:''' The documentation has been re-factored into several pages.  See the table of contents on the right for a complete listing of topics. Other GeoDjango pages include: 
     5 * [wiki:GeoDjangoBackground Background Information] 
     6 * [wiki:GeoDjangoModelAPI Model API] 
     7 * [wiki:GeoDjangoDatabaseAPI Database API] 
    38 
    49= Implementation = 
     
    3540   * '''Update:''' As of r5008, GeoDjango has its own GEOS interface (via {{{ctypes}}}) 
    3641   * GEOS is no longer maintained by Sean Gillies.  ''See'' Sean Gillies, ''[http://zcologia.com/news/150/geometries-for-python/ Geometries for Python]'' (blog post explaining rationale for abandoning GEOS support); ''see also'' Sean's message on the [http://geos.refractions.net/pipermail/geos-devel/2007-March/002851.html GEOS-Devel Mailing List] (Mar. 5, 2007). 
    37    * Might consider either ~~using PCL~~ or implement a {{{ctypes}}} wrapper for the routines that we need -- can't really port PCL code here because it is GPL (Django is licensed under BSD). 
    3842 * WMS Server 
    3943   * I'm not satisfied with any of the current WMS/WFS implementations.   One implemented in Django would be desirable, e.g., {{{django.contrib.gis.wms}}}.  Thoughts anyone?  (OWSLib looks good, see below) 
     
    4650   * Utilities 
    4751   * Database representation ideas 
    48    * GEOS support, Sean Gilles (lead developer of PCL) looking for help maintaining Python/SWIG interface to GEOS.  If SWIG interface no longer maintained, might have to move to PCL for up-to-date GEOS library support. 
     52   * GEOS support, [http://zcologia.com/news/ Sean Gilles] (of PCL) was the maintainer of the old SWIG bindings, and is working on [http://trac.gispython.org/projects/PCL/wiki/ShapeLy ShapeLy], a GeoDjango-inspired GEOS ctypes interface. 
    4953 * [http://code.google.com/p/django-coordinatesfield/ CoordinatesField]. 
    5054   * Jannis Leidel has already come up with a way to manipulate points in the admin interface, BSD licensed. 
     
    115119 
    116120== Spatial Queries == 
    117 After a geographic model has been created, the PostGIS additions to the API may be used.  Geographic queries are done normally by using {{{filter()}}} and {{{exclude()}}} on geometry-enabled models using geographic lookup types (''see'' the [GeoDjango#DatabaseAPI Database API] below for lookup types).  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 if the ''polygon'' actually contains the specific point, not just the bounding box. 
     121After a geographic model has been created, the PostGIS additions to the API may be used.  Geographic queries are done normally by using {{{filter()}}} and {{{exclude()}}} on geometry-enabled models using geographic lookup types (''see'' the [wiki:GeoDjangoDatabaseAPI Database API] for lookup types).  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 if the ''polygon'' actually contains the specific point, not just the bounding box. 
    118122{{{ 
    119123#!python 
     
    136140 
    137141= Installation = 
    138 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.~~ Community support for prerequisites is better than previously believed, Windows support will come much earlier than expected. 
     142Installation 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. 
    139143== Python & PostgreSQL == 
    140144 * '''Python''' 
     
    198202 * Finally, update your {{{settings.py}}} to reflect the name and user for the spatially enabled database.  So far, we only plan to support the psycopg2 backend, thus: {{{DATABASE_ENGINE='postgresql_psycopg2'}}}. 
    199203== GDAL == 
    200  * Optional, but highly useful for coordinate transformations and reading/writing ''both'' vector (e.g. SHP) and raster (e.g. TIFF) geographic data. 
     204 * ''Highly Recommended'': Some features (e.g. a large number of {{{SpatialRefSys}}} model routines) require GDAL, but it is not necessary for core functionality (e.g. spatial queries). 
     205 * GDAL/OGR includes useful for coordinate transformations and reading/writing ''both'' vector (e.g. SHP) and raster (e.g. GeoTIFF) geographic data. 
    201206   * For example, the following command will convert your SHP file into [http://en.wikipedia.org/wiki/WGS84 WGS84] (standard lat/lon).  Then you can import directly into your database using {{{shp2pgsql}}} (utility from PostGIS): 
    202207{{{ 
     
    209214# make install 
    210215}}} 
    211  * As of r5397 there's a {{{ctypes}}} layer for GDAL/OGR, no python bindings needed. 
    212  
     216 * As of r5397 there's a {{{ctypes}}} layer for GDAL/OGR, no additional Python bindings are needed.   
     217 * If you still want to use the GDAL Python API for your own applications, then use either of the following mutually exclusive configuration flags: 
     218   * {{{--with-python}}}: the deprecated, but stable API. 
     219   * {{{--ng-python}}}: the "next-generation" SWIG-based bindings, but may be problematic for some users (''e.g.'', Python 2.5 platforms). 
     220 
     221== Windows == 
     222 
     223Though GeoDjango is not yet "officially" supported for Windows (due to documentation, see #4397), our ctypes interfaces have made compatibility with Windows 2000/XP a reality.  The developer uses binary libraries from the following open-source projects (for Windows): 
     224 * [http://www.postgis.org/news/20070319/ PostGIS 1.2.1 Windows Technology Preview]: Installs PostGIS 1.2.1 on Windows, and includes GEOS 3.0.0RC4 and proj libraries as well. 
     225   * Copy {{{libgeos-3-0-0rc4.dll}}}, {{{libgeos_c-1.dll}}}, and {{{libproj.dll}}} to your Python directory (''e.g.'', {{{C:\Python25}}}) 
     226 * [http://blog.qgis.org/?q=node/71 QGIS Windows 0.8.1 Release Candidate 1]: Installs QGIS, an open-source desktop application for GIS, similar to ArcView.  Includes GDAL and its own proj libraries (more documentation forthcoming).