Changes between Version 73 and Version 74 of GeoDjango
- Timestamp:
- May 24, 2007, 8:47:16 PM (18 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
GeoDjango
v73 v74 89 89 * Support for a mapping framework (e.g. Google Maps/Earth, Yahoo Maps, MS Live, etc.) 90 90 * Admin fields and forms (WKT field currently as of r4884, but we want widgets to view and manipulate geographic objects). 91 * Utilities for importing raster data (SHP files first) directly into Django models -- will be done with the forthcoming {{{LayerMapping}}} class.91 * Utilities for importing vector and raster data (SHP files first) directly into Django models -- will be done with the forthcoming {{{LayerMapping}}} class. 92 92 * Distance queries, calculations, and related utilities. 93 93 * '''Complete''' … … 144 144 class School(models.Model, models.GeoMixin): 145 145 name = models.CharField(maxlength=35) 146 point = models.PointField( index=True)146 point = models.PointField() 147 147 148 148 objects = models.GeoManager() 149 149 }}} 150 150 151 '''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.151 '''Notes''': The {{{GeoMixin}}} class allows for [GeoDjango#ExtraInstanceMethods extra instance methods]. By default, a GiST index will be created for the School {{{PointField}}}s fields. This behavior can be turned off by using {{{models.PointField(index=False)}}}. 152 152 153 153 == Using syncdb == … … 168 168 SELECT AddGeometryColumn('geo_app_school', 'point', 4326, 'POINT', 2); 169 169 CREATE INDEX "geo_app_school_point_id" ON "geo_app_school" USING GIST ( "point" GIST_GEOMETRY_OPS ); 170 SELECT AddGeometryColumn('geo_app_district', 'poly', 4326, 'MULTIPOLYGON', 2); 170 SELECT AddGeometryColumn('geo_app_district', 'poly', 4326, 'POLYGON', 2); 171 CREATE INDEX "geo_app_district_poly_id" ON "geo_app_district" USING GIST ( "poly" GIST_GEOMETRY_OPS ); 171 172 COMMIT; 172 173 $ python manage.py syncdb geo_app … … 294 295 class Zip(models.Model, models.GeoMixin): 295 296 code = models.IntegerField() 296 poly = models.PolygonField(srid=-1 , index=True)297 poly = models.PolygonField(srid=-1) 297 298 298 299 object = models.GeoManager() … … 302 303 * 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. 2.3.8 (Geometry Values and Spatial Reference Systems, pg. 39). 303 304 * {{{index}}} 304 * If set to True, will createa 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).305 * Defaults to True. Creates 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). 305 306 306 307 == Creating and Saving Models with Geometry Fields == … … 358 359 * Returns true if A's bounding box is strictly above B's bounding box. 359 360 * PostGIS equivalent "{{{|>>}}}" 360 * {{{same_as}}} 361 * {{{same_as}}} or {{{exact}}} 361 362 * The "same as" operator. It tests actual geometric equality of two features. So if A and B are the same feature, vertex-by-vertex, the operator returns true. 362 363 * PostGIS equivalent "{{{~=}}}"