Changes between Version 66 and Version 67 of GeoDjango
- Timestamp:
- Apr 15, 2007, 11:22:30 PM (18 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
GeoDjango
v66 v67 82 82 == Phase 2 == 83 83 * '''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)85 84 * Add as much from the PostGIS API as possible. 86 85 * Support for a mapping framework (e.g. Google Maps/Earth, Yahoo Maps, MS Live, etc.) … … 88 87 * Utilities for importing raster data (SHP files first) directly into Django models. 89 88 * '''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) 91 91 92 92 == Phase 3 == … … 102 102 * [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). 103 103 * GEOS 104 * '''Update:''' As of r5008, GeoDjango has its own GEOS interface (via {{{ctypes}}}) 104 105 * 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). 105 106 * 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). … … 201 202 == GEOS == 202 203 * 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-python204 * '''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 208 209 $ make 209 210 # make install … … 250 251 ogr2ogr -t_srs WGS84 output.shp input.shp 251 252 }}} 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- python253 * 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 255 256 $ make 256 257 # make install 257 258 }}} 258 * ''Note'': This is done with out 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}}}. 259 260 260 261 = Model API = … … 390 391 A model with geometry fields will get the following methods: 391 392 393 == get_GEOM_geos == 394 For 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 402 POINT(-95.231713 29.723235) 403 >>> print geom.area 404 0.08332 405 >>> print geom.geom_type 406 Polygon 407 >>> print geom.centroid.geom_type 408 Point 409 >>> print geom.intersects(GEOSGeometry('POINT(-95.395223 29.798088)')) 410 False 411 }}} 412 392 413 == get_GEOM_wkt == 393 414 394 For every geometry field, the model objectwill have a {{{get_GEOM_wkt}}} method, where {{{GEOM}}} is the name of the geometry field. For example (using the {{{School}}} model from above):415 For 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): 395 416 396 417 {{{ … … 403 424 == get_GEOM_centroid == 404 425 405 For every geometry field, the model objectwill 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):426 For 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): 406 427 407 428 {{{ … … 414 435 == get_GEOM_area == 415 436 416 For every geometry field, the model objectwill have a {{{get_GEOM_area}}} method, where {{{GEOM}}} is the name of the geometry field. This routine will return the area of the geometry.437 For 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. 417 438 418 439 {{{