Changes between Version 123 and Version 124 of GeoDjango


Ignore:
Timestamp:
03/11/2009 02:42:31 PM (6 years ago)
Author:
jbronn
Comment:

question about GeoQ is irrelevant now

Legend:

Unmodified
Added
Removed
Modified
  • GeoDjango

    v123 v124  
    101101 * '''Q:''' Why are the OGRGeometry methods `transform` and `transform_to` separate?
    102102   * 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 GeoQ
    107 >>> from geoapp.models import City, Country, State # See django.contrib.gis.tests.geoapp
    108 >>> 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 }}}
    113103
    114104== Example ==
Back to Top