mirror of
https://github.com/django/django.git
synced 2025-10-31 09:41:08 +00:00
Removed GeoManager and GeoQuerySet per deprecation timeline.
This commit is contained in:
@@ -3,9 +3,6 @@ from django.utils.encoding import python_2_unicode_compatible
|
||||
|
||||
|
||||
class SimpleModel(models.Model):
|
||||
|
||||
objects = models.GeoManager()
|
||||
|
||||
class Meta:
|
||||
abstract = True
|
||||
required_db_features = ['gis_enabled']
|
||||
|
||||
@@ -38,33 +38,6 @@ class RelatedGeoModelTest(TestCase):
|
||||
self.assertEqual(st, c.state)
|
||||
self.assertEqual(Point(lon, lat, srid=c.location.point.srid), c.location.point)
|
||||
|
||||
@skipUnlessDBFeature("has_transform_method")
|
||||
def test03_transform_related(self):
|
||||
"Testing the `transform` GeoQuerySet method on related geographic models."
|
||||
# All the transformations are to state plane coordinate systems using
|
||||
# US Survey Feet (thus a tolerance of 0 implies error w/in 1 survey foot).
|
||||
tol = 0
|
||||
|
||||
def check_pnt(ref, pnt):
|
||||
self.assertAlmostEqual(ref.x, pnt.x, tol)
|
||||
self.assertAlmostEqual(ref.y, pnt.y, tol)
|
||||
self.assertEqual(ref.srid, pnt.srid)
|
||||
|
||||
# Each city transformed to the SRID of their state plane coordinate system.
|
||||
transformed = (('Kecksburg', 2272, 'POINT(1490553.98959621 314792.131023984)'),
|
||||
('Roswell', 2257, 'POINT(481902.189077221 868477.766629735)'),
|
||||
('Aurora', 2276, 'POINT(2269923.2484839 7069381.28722222)'),
|
||||
)
|
||||
|
||||
for name, srid, wkt in transformed:
|
||||
# Doing this implicitly sets `select_related` select the location.
|
||||
# TODO: Fix why this breaks on Oracle.
|
||||
qs = list(City.objects.filter(name=name).transform(srid, field_name='location__point'))
|
||||
check_pnt(GEOSGeometry(wkt, srid), qs[0].location.point)
|
||||
|
||||
# Relations more than one level deep can be queried.
|
||||
self.assertEqual(list(Parcel.objects.transform(srid, field_name='city__location__point')), [])
|
||||
|
||||
@skipUnlessDBFeature("supports_extent_aggr")
|
||||
def test_related_extent_aggregate(self):
|
||||
"Testing the `Extent` aggregate on related geographic models."
|
||||
@@ -190,13 +163,13 @@ class RelatedGeoModelTest(TestCase):
|
||||
self.assertEqual('P1', qs[0].name)
|
||||
|
||||
def test07_values(self):
|
||||
"Testing values() and values_list() and GeoQuerySets."
|
||||
"Testing values() and values_list()."
|
||||
gqs = Location.objects.all()
|
||||
gvqs = Location.objects.values()
|
||||
gvlqs = Location.objects.values_list()
|
||||
|
||||
# Incrementing through each of the models, dictionaries, and tuples
|
||||
# returned by the different types of GeoQuerySets.
|
||||
# returned by each QuerySet.
|
||||
for m, d, t in zip(gqs, gvqs, gvlqs):
|
||||
# The values should be Geometry objects and not raw strings returned
|
||||
# by the spatial database.
|
||||
@@ -234,7 +207,7 @@ class RelatedGeoModelTest(TestCase):
|
||||
# TODO: fix on Oracle -- qs2 returns an empty result for an unknown reason
|
||||
@no_oracle
|
||||
def test10_combine(self):
|
||||
"Testing the combination of two GeoQuerySets. See #10807."
|
||||
"Testing the combination of two QuerySets (#10807)."
|
||||
buf1 = City.objects.get(name='Aurora').location.point.buffer(0.1)
|
||||
buf2 = City.objects.get(name='Kecksburg').location.point.buffer(0.1)
|
||||
qs1 = City.objects.filter(location__point__within=buf1)
|
||||
|
||||
Reference in New Issue
Block a user