Changes between Version 123 and Version 124 of GeoDjango
- Timestamp:
- Mar 11, 2009, 2:42:31 PM (16 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
GeoDjango
v123 v124 101 101 * '''Q:''' Why are the OGRGeometry methods `transform` and `transform_to` separate? 102 102 * They are no longer separate, as `transform` now accepts `CoordTransform` and `SpatialReference` objects, as well as string WKT and integer SRID values (`transform` checks the input type and dispatches to the correct routine). The former reason for the separation was that each mapped to the separate OGR routines [http://www.gdal.org/ogr/ogr__api_8h.html#59a5b3f954b11cfbf6e78807c28d6090 OGR_G_Transform] and [http://www.gdal.org/ogr/ogr__api_8h.html#43af4c2127cea0a5059692a62c0feb63 OGR_G_TransformTo]. For better performance use `CoordTransform` objects when you will be performing the same transformation repeatedly. 103 * '''Q:''' Why don't `Q` objects work?104 * `Q` object functionality is for use with models that use `QuerySet`. Because !GeoDjango models use `GeoQuerySet`, use the `GeoQ` object instead:105 {{{106 >>> from django.contrib.gis.db.models import GeoQ107 >>> from geoapp.models import City, Country, State # See django.contrib.gis.tests.geoapp108 >>> tx = Country.objects.get(name='Texas')109 >>> ks = State.objects.get(name='Kansas')110 >>> City.objects.filter(GeoQ(point__within=tx.mpoly) | GeoQ(point__within=ks.poly))111 [<City: Houston>, <City: Dallas>, <City: Lawrence>]112 }}}113 103 114 104 == Example ==