Changes between Version 66 and Version 67 of GeoDjango


Ignore:
Timestamp:
Apr 15, 2007, 11:22:30 PM (18 years ago)
Author:
jbronn
Comment:

updated for new GEOS library; updated GDAL install

Legend:

Unmodified
Added
Removed
Modified
  • GeoDjango

    v66 v67  
    8282== Phase 2 ==
    8383 * '''Pending'''
    84    * Add geometry-enabled routines to the fields that call directly on GEOS routines -- like area(), centroid(), etc. (partially complete as of r4884. ''See'' [GeoDjango#ExtraInstanceMethods Extra Instance Methods] section below)
    8584   * Add as much from the PostGIS API as possible.
    8685   * Support for a mapping framework (e.g. Google Maps/Earth, Yahoo Maps, MS Live, etc.)
     
    8887   * Utilities for importing raster data (SHP files first) directly into Django models.
    8988 * '''Complete'''
    90    * PostGIS indexing capability
     89   * PostGIS indexing capability.
     90   * As of r5008, added a GEOS wrapper object for geometry-enabled fields that call directly on GEOS routines (''e.g.'' {{{z.get_poly_geos().area}}}).  ''See'' [GeoDjango#ExtraInstanceMethods Extra Instance Methods] section below)
    9191
    9292== Phase 3 ==
     
    102102   * [http://mapserver.gis.umn.edu/ Mapserver] has been around for a while, strong backing in the community (e.g. native support in [http://qgis.org/ QGIS]).  Even with documentation, the code looks less inviting than Mapnik (all in C); also has archaic text-based configuration files (pre-dating markup languages).
    103103 * GEOS
     104   * '''Update:''' As of r5008, GeoDjango has its own GEOS interface (via {{{ctypes}}})
    104105   * 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).
    105106   * 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).
     
    201202== GEOS ==
    202203 * Latest [http://geos.refractions.net/ GEOS] version is 3.0.0RC4
    203    * Also requires SWIG >= 1.3.28.  (Ubuntu Dapper comes with 1.3.27.)
    204    * If there's trouble locating your python, include {{{PYTHON=/path/to/python}}}, or {{{--enable-python=/path/to/python}}}.
    205  * Configure (enabling python), make, and install.
    206 {{{
    207 $ ./configure --enable-python
     204 * '''Update:''' As of r5008, you do ''not'' need to enable the Python bindings because GeoDjango has its own GEOS {{{ctypes}}} wrapper.
     205   * {{{ctypes}}} comes standard with Python 2.5.  If you run Python 2.4, {{{ctypes}}} may be [http://sourceforge.net/project/showfiles.php?group_id=71702&package_id=71318 downloaded here]
     206 * Configure, make, and install.
     207{{{
     208$ ./configure
    208209$ make
    209210# make install
     
    250251ogr2ogr -t_srs WGS84 output.shp input.shp
    251252}}}
    252  * Latest [http://www.gdal.org/download.html GDAL] version is 1.4.0.  Configure with GEOS and Python support, then make and install:
    253 {{{
    254 $ ./configure --with-geos --with-python
     253 * Latest [http://www.gdal.org/download.html GDAL] version is 1.4.1.  Configure with GEOS and Python support, then make and install:
     254{{{
     255$ ./configure --with-geos --with-ngpython
    255256$ make
    256257# make install
    257258}}}
    258  * ''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.
     259 * ''Note'': This is done with the 'next generation' SWIG Python bindings. The compilation flag to enable the old bindings (no longer supported) is {{{--with-python}}}.
    259260
    260261= Model API =
     
    390391A model with geometry fields will get the following methods:
    391392
     393== get_GEOM_geos ==
     394For every geometry field the model instance will have a {{{get_GEOM_geos}}} method, where {{{GEOM}}} is the name of the geometry field.  Returns a {{{GEOSGeometry}}} instance for the geometry.  For example (using the {{{District}}} model from above):
     395
     396{{{
     397#!python
     398>>> from django.contrib.gis.geos import GEOSGeometry
     399>>> dist = District.objects.get(name='Houston ISD')
     400>>> geom = dist.get_poly_geos()
     401>>> print geom.centroid.wkt
     402POINT(-95.231713 29.723235)
     403>>> print geom.area
     4040.08332
     405>>> print geom.geom_type
     406Polygon
     407>>> print geom.centroid.geom_type
     408Point
     409>>> print geom.intersects(GEOSGeometry('POINT(-95.395223 29.798088)'))
     410False
     411}}}
     412
    392413== get_GEOM_wkt ==
    393414
    394 For every geometry field, the model object will have a {{{get_GEOM_wkt}}} method, where {{{GEOM}}} is the name of the geometry field.  For example (using the {{{School}}} model from above):
     415For every geometry field, the model instance will have a {{{get_GEOM_wkt}}} method, where {{{GEOM}}} is the name of the geometry field.  For example (using the {{{School}}} model from above):
    395416
    396417{{{
     
    403424== get_GEOM_centroid ==
    404425
    405 For every geometry field, the model object will have a {{{get_GEOM_centroid}}} method, where {{{GEOM}}} is the name of the geometry field.  This routine will return the centroid of the geometry.  For example (using the {{{District}}} model from above):
     426For every geometry field, the model instance will have a {{{get_GEOM_centroid}}} method, where {{{GEOM}}} is the name of the geometry field.  This routine will return the centroid of the geometry.  For example (using the {{{District}}} model from above):
    406427
    407428{{{
     
    414435== get_GEOM_area ==
    415436
    416 For every geometry field, the model object will have a {{{get_GEOM_area}}} method, where {{{GEOM}}} is the name of the geometry field.  This routine will return the area of the geometry.
     437For every geometry field, the model instance will have a {{{get_GEOM_area}}} method, where {{{GEOM}}} is the name of the geometry field.  This routine will return the area of the geometry.
    417438
    418439{{{
Back to Top