Django

Code

Show
Ignore:
Timestamp:
06/15/08 14:48:57 (7 months ago)
Author:
jbronn
Message:

gis: Refactor of the GeoQuerySet; new features include:

(1) Creation of internal API that eases generation of GeoQuerySet methods.
(2) GeoQuerySet.distance now returns Distance objects instead of floats.
(3) Added the new GeoQuerySet methods: area, centroid, difference, envelope, intersection, length, make_line, mem_size, num_geom, num_points, perimeter, point_on_surface, scale, svg, sym_difference, translate, union.
(4) The model_att keyword may be used to customize the attribute that GeoQuerySet methods attach output to.
(5) Geographic distance lookups and GeoQuerySet.distance calls now use ST_distance_sphere by default (performance benefits far outweigh small loss in accuracy); ST_distance_spheroid may still be used by specifying an option.
(6) GeoQuerySet methods may now operate accross ForeignKey? relations specified via the field_name keyword (but this does not work on Oracle).
(7) Area now has the same units of measure as Distance.

Backward Incompatibilites:

  • The aggregate union method is now known as unionagg.
  • The field_name keyword used for GeoQuerySet methods may no longer be specified via positional arguments.
  • Distance objects returned instead of floats from GeoQuerySet.distance.
  • ST_Distance_sphere used by default for geographic distance calculations.
Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/branches/gis/django/contrib/gis/tests/geoapp/tests_mysql.py

    r7482 r7641  
    170170    def test07_mysql_limitations(self): 
    171171        "Testing that union(), kml(), gml() raise exceptions." 
    172         self.assertRaises(ImproperlyConfigured, City.objects.union, 'point') 
    173         self.assertRaises(ImproperlyConfigured, State.objects.all().kml, 'poly') 
    174         self.assertRaises(ImproperlyConfigured, Country.objects.all().gml, 'mpoly') 
     172        self.assertRaises(ImproperlyConfigured, City.objects.union, Point(5, 23), field_name='point') 
     173        self.assertRaises(ImproperlyConfigured, State.objects.all().kml, field_name='poly') 
     174        self.assertRaises(ImproperlyConfigured, Country.objects.all().gml, field_name='mpoly') 
    175175 
    176176def suite():