Changes between Version 56 and Version 57 of GeoDjango
- Timestamp:
- Apr 3, 2007, 9:16:04 AM (18 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
GeoDjango
v56 v57 7 7 * [GeoDjango#FAQ FAQ] 8 8 * [GeoDjango#Implementation Implementation] 9 * [GeoDjango#Phase1 Phase 1] 10 * [GeoDjango#Phase2 Phase 2] 11 * [GeoDjango#Phase3 Phase 3] 12 * [GeoDjango#DesignIssues Design Issues] 13 * [GeoDjango#Collaboration Collaboration] 9 14 * [GeoDjango#Example Example] 15 * [GeoDjango#GeographicModels Geographic Models] 16 * [GeoDjango#Usingsyncdb Using syncdb] 17 * [GeoDjango#SpatialQueries Spatial Queries] 10 18 * [GeoDjango#Installation Installation] 11 19 * [GeoDjango#Django GeoDjango Branch from SVN] ('''required''') … … 74 82 * '''Pending''' 75 83 * 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) 76 * Admin fields and forms (WKT field currently as of r4884, but we want widgets to view and manipulate geographic objects).77 84 * Add as much from the PostGIS API as possible. 78 * Support for mapping frameworks (e.g. Google Maps/Earth, Yahoo Maps, MS Live, etc.) 85 * Support for a mapping framework (e.g. Google Maps/Earth, Yahoo Maps, MS Live, etc.) 86 * Admin fields and forms (WKT field currently as of r4884, but we want widgets to view and manipulate geographic objects). 79 87 * Utilities for importing raster data (SHP files first) directly into Django models. 80 88 * '''Complete''' … … 83 91 == Phase 3 == 84 92 * Support MySQL databases. 93 94 == Design Issues == 95 * Mapping JS framework -- do we want to support OpenLayers, the Google Maps API, the Yahoo API? 96 * GEOS 97 * GEOS is no longer maintained by Sean Gillies. ''See'' Sean's message on the [http://geos.refractions.net/pipermail/geos-devel/2007-March/002851.html GEOS-Devel Mailing List] (Mar. 5, 2007) 98 * 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). 99 * WMS Server 100 * 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? 101 * MapNik is modern, but very early on in development and lacks documentation. 85 102 86 103 == Collaboration == … … 94 111 95 112 = Example = 113 114 == Geographic Models == 96 115 Here is an example of how the model API currently works (assume this example is in geo_app/models.py): 97 116 {{{ … … 114 133 '''Notes''': The {{{GeoMixin}}} class allows for [GeoDjango#ExtraInstanceMethods extra instance methods]. The {{{index}}} keyword is used to indicate that a GiST index be created for the School {{{PointField}}}s fields. 115 134 116 Use the {{{manage.py}}} just like you normally would: 135 == Using syncdb == 136 Use the {{{manage.py}}} to invoke {{{syncdb}}} like you normally would: 117 137 {{{ 118 138 $ python manage.py sqlall geo_app … … 135 155 }}} 136 156 137 PostGIS additions to the API may now be used. Geographic queries are done by normally by using {{{filter()}}} and {{{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 if the ''polygon'' actually contains the specific point, not just the bounding box. 157 '''Note:''' The geometry columns are created outside of the {{{CREATE TABLE}}} statements by the {{{AddGeometryColumn}}}. This is done according to the OpenGIS specfication. ''See'' ''See'' Open GIS Consortium, Inc., ''[http://www.opengis.org/docs/99-049.pdf OpenGIS Simple Feature Specification For SQL]'', Document 99-049 (May 5, 1999), at Ch. 2.3.8 (Geometry Values and Spatial Reference Systems, pg. 39). 158 159 == Spatial Queries == 160 After a geographic model has been created, the PostGIS additions to the API may be used. Geographic queries are done by 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. 138 161 {{{ 139 162 >>> from geo_app.models import District, School … … 238 261 239 262 * {{{srid}}} 240 * Sets the SRID (S ource Reference Identifier) of geometry to the given value. Defaults to 4326 (WGS84)263 * Sets the SRID (Spatial Reference System Identity) of geometry to the given value. Defaults to 4326 (WGS84). ''See'' Open GIS Consortium, Inc., ''[http://www.opengis.org/docs/99-049.pdf OpenGIS Simple Feature Specification For SQL]'', Document 99-049 (May 5, 1999), at Ch. 3.2.5 (SQL Textual Representation of Geometry, pg. 53) 241 264 * {{{index}}} 242 265 * If set to True, will create a GiST index for the given geometry. Update the index with the PostgreSQL command {{{VACUUM ANALYZE}}} (may take a while to execute depending on how large your geographic-enabled tables are). … … 253 276 Geometries are represented as '''strings''' in either of the formats WKT (Well Known Text) or HEXEWKB (PostGIS specific, essentially a WKB geometry in hexadecimal). For example: 254 277 * WKT Polygon: {{{'POLYGON(( 10 10, 10 20, 20 20, 20 15, 10 10))'}}} 255 * ''See'' Open GIS Consortium, Inc., ''[http:// portal.opengeospatial.org/files/?artifact_id=829&ei=Z5oGRv6aCZ-IwQKh2LXwAw&usg=__4YgoHsbqjocl8Z01SwMAyN84aW0=&sig2=4DpSpm83ZDEIBKSivWcYGQOpenGIS Simple Feature Specification For SQL]'', Document 99-049 (May 5, 1999), at Ch. 3.2.5 (SQL Textual Representation of Geometry, pg. 53).278 * ''See'' Open GIS Consortium, Inc., ''[http://www.opengis.org/docs/99-049.pdf OpenGIS Simple Feature Specification For SQL]'', Document 99-049 (May 5, 1999), at Ch. 3.2.5 (SQL Textual Representation of Geometry, pg. 53). 256 279 * HEXEWKB Polygon: '{{{0103000000010000000 ... 00000000000002440'}}} 257 280 * ''See'' [http://postgis.refractions.net/docs/ch04.html#id2904792 "PostGIS EWKB, EWKT and Canonical Forms"], PostGIS documentation at Ch. 4.1.2. … … 268 291 == PostGIS Operator Field Lookup Types == 269 292 270 * ''See generally'', [http://postgis.refractions.net/docs/ch06.html#id2 618041 "Operators", PostGIS Documentation at Ch. 6.2.2]293 * ''See generally'', [http://postgis.refractions.net/docs/ch06.html#id2854381 "Operators", PostGIS Documentation at Ch. 6.2.2] 271 294 * '''Note:''' This API is subject to some change -- we're open to suggestions. 272 295 * {{{overlaps_left}}} … … 363 386 == get_GEOM_area == 364 387 365 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.388 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. 366 389 367 390 {{{