Python django.contrib.gis.db.models.PointField() Examples
The following are 2
code examples of django.contrib.gis.db.models.PointField().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
django.contrib.gis.db.models
, or try the search function
.
Example #1
Source File: tests.py From djongo with GNU Affero General Public License v3.0 | 5 votes |
def test_cast_aggregate(self): """ Cast a geography to a geometry field for an aggregate function that expects a geometry input. """ if not connection.ops.geography: self.skipTest("This test needs geography support") expected = (-96.8016128540039, 29.7633724212646, -95.3631439208984, 32.782058715820) res = City.objects.filter( name__in=('Houston', 'Dallas') ).aggregate(extent=models.Extent(Cast('point', models.PointField()))) for val, exp in zip(res['extent'], expected): self.assertAlmostEqual(exp, val, 4)
Example #2
Source File: tests.py From djongo with GNU Affero General Public License v3.0 | 5 votes |
def test_cast_aggregate(self): """ Cast a geography to a geometry field for an aggregate function that expects a geometry input. """ if not connection.ops.geography: self.skipTest("This test needs geography support") expected = (-96.8016128540039, 29.7633724212646, -95.3631439208984, 32.782058715820) res = City.objects.filter( name__in=('Houston', 'Dallas') ).aggregate(extent=models.Extent(Cast('point', models.PointField()))) for val, exp in zip(res['extent'], expected): self.assertAlmostEqual(exp, val, 4)