Here are the examples of the python api django.contrib.gis.geos.Point taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
166 Examples
3
Source : api_views.py
with MIT License
from acdh-oeaw
with MIT License
from acdh-oeaw
def get_queryset(self):
lat = self.request.query_params.get('lat', None)
lng = self.request.query_params.get('lng', None)
pnt = Point(float(lng), float(lat))
qs = TempSpatial.objects.filter(geom__contains=pnt)
when = self.request.query_params.get('when', None)
if when is not None:
try:
when = parse(when)
except ValueError:
when = None
if when:
qs = qs.filter(temp_extent__contains=when).order_by('spatial_extent')
return qs
3
Source : views.py
with MIT License
from acdh-oeaw
with MIT License
from acdh-oeaw
def form_valid(self, form, **kwargs):
context = super(WhereWas, self).get_context_data(**kwargs)
cd = form.cleaned_data
pnt = Point(cd['lng'], cd['lat'])
qs = TempSpatial.objects.filter(geom__contains=pnt)
when = cd['when']
if when is not None:
qs = qs.filter(temp_extent__contains=when)
else:
qs = qs
if qs:
context['answer'] = qs.order_by('spatial_extent')
else:
context['answer'] = ["No Match"]
context['point'] = pnt
return render(self.request, self.template_name, context)
class TempSpatialListView(GenericListView):
3
Source : base.py
with GNU General Public License v3.0
from Aghoreshwar
with GNU General Public License v3.0
from Aghoreshwar
def geos(self, query):
"Return a GEOS Point object for the given query."
ll = self.lon_lat(query)
if ll:
from django.contrib.gis.geos import Point
return Point(ll, srid=4326)
else:
return None
# #### GeoIP Database Information Routines ####
@property
3
Source : io.py
with GNU General Public License v3.0
from Aghoreshwar
with GNU General Public License v3.0
from Aghoreshwar
def _handle_empty_point(self, geom):
from django.contrib.gis.geos import Point
if isinstance(geom, Point) and geom.empty:
if self.srid:
# PostGIS uses POINT(NaN NaN) for WKB representation of empty
# points. Use it for EWKB as it's a PostGIS specific format.
# https://trac.osgeo.org/postgis/ticket/3181
geom = Point(float('NaN'), float('NaN'), srid=geom.srid)
else:
raise ValueError('Empty point is not representable in WKB.')
return geom
def write(self, geom):
3
Source : test_filters.py
with Mozilla Public License 2.0
from Amsterdam
with Mozilla Public License 2.0
from Amsterdam
def setUp(self):
geometry = MultiPolygon([Polygon.from_bbox([4.877157, 52.357204, 4.929686, 52.385239])], srid=4326)
self.pt_in_center = Point(4.88, 52.36)
self.pt_out_center = Point(6, 53)
self.area = AreaFactory.create(geometry=geometry, name='Centrum', code='centrum', _type__code='district')
SignalFactory.create(
location__geometrie=self.pt_in_center,
location__area_code=self.area.code,
location__area_type_code=self.area._type.code,
)
# no area code, but with geo location
SignalFactory.create(location__geometrie=self.pt_out_center)
def test_filter_areas(self):
3
Source : test_mixins.py
with Mozilla Public License 2.0
from Amsterdam
with Mozilla Public License 2.0
from Amsterdam
def test_validate_geometrie(self):
# note this test bypasses the API
correct = Point(IN_THE_NETHERLANDS)
wrong = Point(OUTSIDE_THE_NETHERLANDS)
# check that valid data is returned, and wrong data rejected
v = WithinBoundingBoxValidatorMixin()
self.assertEqual(correct, v.validate_geometrie(correct))
with self.assertRaises(serializers.ValidationError):
v.validate_geometrie(wrong)
3
Source : in_evaluator.py
with Mozilla Public License 2.0
from Amsterdam
with Mozilla Public License 2.0
from Amsterdam
def _get_type(self, obj):
if isinstance(obj, str):
return 'str'
elif isinstance(obj, geos.Point):
return 'point'
else:
return 'unknown'
def _raise_type_error(self, exp, act):
3
Source : test_tdo.py
with Mozilla Public License 2.0
from Amsterdam
with Mozilla Public License 2.0
from Amsterdam
def setUp(self):
self.signal_count = 5
self.created_at = timezone.now() - timezone.timedelta(days=1)
self.point_cityhall = Point(52.367640, 4.899527, srid=4326)
with freeze_time(self.created_at):
SignalFactory.create_batch(size=self.signal_count, status__state=workflow.GEMELD)
def test_count(self):
3
Source : location.py
with Mozilla Public License 2.0
from Amsterdam
with Mozilla Public License 2.0
from Amsterdam
def get_puntje():
lon = FuzzyFloat(BBOX[0], BBOX[2]).fuzz()
lat = FuzzyFloat(BBOX[1], BBOX[3]).fuzz()
return Point(float(lon), float(lat))
class LocationFactory(DjangoModelFactory):
3
Source : location.py
with Mozilla Public License 2.0
from Amsterdam
with Mozilla Public License 2.0
from Amsterdam
def set_valid_location(self, create, extracted, **kwargs):
valid_location = copy.copy(random.choice(VALID_LOCATIONS))
longitude = valid_location.pop('lon')
lattitude = valid_location.pop('lat')
self.geometrie = Point(longitude, lattitude)
self.buurt_code = valid_location.pop('buurt_code')
self.stadsdeel = valid_location.pop('stadsdeel')
self.address = valid_location
3
Source : test_managers.py
with Mozilla Public License 2.0
from Amsterdam
with Mozilla Public License 2.0
from Amsterdam
def setUp(self):
self.signal = SignalFactory()
self.category = CategoryFactory()
self.category_assignment = CategoryAssignment.objects.create(category=self.category,
_signal_id=self.signal.id)
self.link_category = '/signals/v1/public/terms/categories/{}/sub_categories/{}'.format(
self.category.parent.slug, self.category.slug
)
geometry = MultiPolygon([Polygon.from_bbox([4.877157, 52.357204, 4.929686, 52.385239])], srid=4326)
self.pt_in_center = Point(4.88, 52.36)
self.pt_out_center = Point(6, 53)
self.area = AreaFactory.create(geometry=geometry, name='Centrum', code='centrum', _type__code='district')
@patch('signals.apps.signals.models.CategoryAssignment.objects.create')
3
Source : test_views.py
with MIT License
from azavea
with MIT License
from azavea
def setUpClass(cls):
super(NonTemporalRecordViewTestCase, cls).setUpClass()
# Create dummy data for a RecordType with no datetime information.
cls.nontemporal_record_type = RecordType.objects.create(label='Nontemporal',
plural_label='Nontemporals',
geometry_type='point',
temporal=False)
cls.nontemporal_schema = RecordSchema.objects.create(record_type=cls.nontemporal_record_type,
version=1,
schema={})
cls.nontemporal_record = Record.objects.create(schema=cls.nontemporal_schema,
data='{}',
geom=Point(0, 0))
# The base endpoint for listing records.
cls.record_endpt = reverse('record-list')
def test_create_nontemporal_record(self):
3
Source : location_assets.py
with Apache License 2.0
from bcgov
with Apache License 2.0
from bcgov
def load_from_json(self, row):
Hospital.objects.create(
sv_reference=row['SV_REFERENCE'],
rg_name=row['RG_NAME'],
name=row['SV_NAME'],
point=Point(float(row["LONGITUDE"]), float(row["LATITUDE"])),
)
class Court(Location):
3
Source : test_opportunity.py
with Apache License 2.0
from bcgov
with Apache License 2.0
from bcgov
def test_fields(self):
approval_status = ApprovalStatus(status_name="Test status",
status_description="This is a test status",
status_code="TEST",
active_status=True)
opportunity = Opportunity(1, "555 Testing Rd.", Point(110, -80, srid=4326), approval_status=approval_status)
self.assertEqual(opportunity.id, 1)
self.assertEqual(opportunity.address, "555 Testing Rd.")
self.assertEqual(opportunity.point, Point(110, -80, srid=4326))
self.assertEqual(opportunity.approval_status, approval_status)
3
Source : test_opportunity.py
with Apache License 2.0
from bcgov
with Apache License 2.0
from bcgov
def test_field_content(self):
opportunity = Opportunity(1, "555 Testing Rd.", Point(110, -80, srid=4326))
serializer = OpportunitySerializer(instance=opportunity)
self.assertEqual(opportunity.address, serializer['address'].value)
self.assertEqual(opportunity.point, serializer['point'].value)
3
Source : factories.py
with GNU Affero General Public License v3.0
from betagouv
with GNU Affero General Public License v3.0
from betagouv
def create_city_saint_andre():
return City.objects.create(
name="Saint-André-des-Eaux",
slug="saint-andre-des-eaux-44",
department="44",
coords=Point(-2.3140436, 47.3618584),
post_codes=["44117"],
code_insee="44117",
)
def create_city_guerande():
3
Source : factories.py
with GNU Affero General Public License v3.0
from betagouv
with GNU Affero General Public License v3.0
from betagouv
def create_city_guerande():
return City.objects.create(
name="Guérande",
slug="guerande-44",
department="44",
coords=Point(-2.4747713, 47.3358576),
# Dummy
post_codes=["44350"],
code_insee="44350",
)
def create_city_vannes():
3
Source : factories.py
with GNU Affero General Public License v3.0
from betagouv
with GNU Affero General Public License v3.0
from betagouv
def create_city_vannes():
return City.objects.create(
name="Vannes",
slug="vannes-56",
department="56",
coords=Point(-2.8186843, 47.657641),
# Dummy
post_codes=["56000"],
code_insee="56000",
)
3
Source : base.py
with MIT License
from chunky2808
with MIT License
from chunky2808
def geos(self, query):
"Returns a GEOS Point object for the given query."
ll = self.lon_lat(query)
if ll:
from django.contrib.gis.geos import Point
return Point(ll, srid=4326)
else:
return None
# #### GeoIP Database Information Routines ####
@property
3
Source : postcodes.py
with GNU General Public License v3.0
from commonknowledge
with GNU General Public License v3.0
from commonknowledge
def to_point(self):
"""
Representation of this postcode's geolocation as a [Django GIS](https://docs.djangoproject.com/en/3.2/ref/contrib/gis/)-compatible point.
Returns:
A Django-GIS Point representing the postcode
"""
return Point(self.longitude, self.latitude, srid=4326)
ResourceT = TypeVar("ResourceT")
3
Source : snippet.py
with Apache License 2.0
from dockerizeme
with Apache License 2.0
from dockerizeme
def example():
from django.contrib.gis.geos import Point
# Calculate the distance to San Franciso from Washington, D.C., via Chicago.
washington = Point(38.53, 77.02)
chicago = Point(41.50, 87.37)
san_francisco = Point(37.47, 122.26)
d = distance(washington, chicago, san_francisco)
print "Washington, D.C. -> Chicago -> San Francisco:"
print "%(miles)0.2f miles, or %(kilometers)0.2f kilometers (or %(fathoms)0.2f fathoms)" % {
'miles': d.mi,
'kilometers': d.km,
'fathoms': d.fathom
}
3
Source : gis.py
with MIT License
from druids
with MIT License
from druids
def get_encrypted_value(self, value, encryption_key: str):
if not is_gis_installed():
raise ImproperlyConfigured('Unable to load django GIS.')
from django.contrib.gis.geos import Point
new_val: Point = Point(value.tuple)
new_val.x = (new_val.x + self.get_numeric_encryption_key(encryption_key, int(new_val.x))) % self.max_x_range
new_val.y = (new_val.y + self.get_numeric_encryption_key(encryption_key, int(new_val.y))) % self.max_y_range
return new_val
def get_decrypted_value(self, value, encryption_key: str):
3
Source : gis.py
with MIT License
from druids
with MIT License
from druids
def get_decrypted_value(self, value, encryption_key: str):
if not is_gis_installed():
raise ImproperlyConfigured('Unable to load django GIS.')
from django.contrib.gis.geos import Point
new_val: Point = Point(value.tuple)
new_val.x = (new_val.x - self.get_numeric_encryption_key(encryption_key, int(new_val.x))) % self.max_x_range
new_val.y = (new_val.y - self.get_numeric_encryption_key(encryption_key, int(new_val.y))) % self.max_y_range
return new_val
3
Source : test_gis_fields.py
with MIT License
from druids
with MIT License
from druids
def test_point_base(self):
from django.contrib.gis.geos import Point
point = Point(1, 1)
out = self.field.get_encrypted_value(point, self.encryption_key)
assert_not_equal(point.tuple, out.tuple)
out_decrypted = self.field.get_decrypted_value(out, self.encryption_key)
assert_tuple_equal(point.tuple, out_decrypted.tuple)
3
Source : test_location.py
with GNU Affero General Public License v3.0
from elnappo
with GNU Affero General Public License v3.0
from elnappo
def setUp(self):
self.grids = (
("JN58ki", Point(10.873333, 48.353333)),
("FK18fi", Point(-77.543333, 18.353333)),
("RH82xe", Point(177.956667, -17.813333)),
)
self.address = (
("Augsburg, Germany", Point(10.897910, 48.368932)),
("69 Westminister Rd, Kingston, Jamaika", Point(-76.800375, 18.020925)),
("Rahmon Nabiyev Street, Dushanbe, Tadschikistan", Point(68.746526, 38.542975)),
)
def test_grid_to_point(self):
3
Source : tests.py
with Apache License 2.0
from gethue
with Apache License 2.0
from gethue
def test_distance_order_by(self):
qs = SouthTexasCity.objects.distance(Point(3, 3)).order_by(
'distance'
).values_list('name', flat=True).filter(name__in=('San Antonio', 'Pearland'))
self.assertSequenceEqual(qs, ['San Antonio', 'Pearland'])
'''
3
Source : tests.py
with Apache License 2.0
from gethue
with Apache License 2.0
from gethue
def test_distance_function_tolerance_escaping(self):
qs = AustraliaCity.objects.annotate(
d=Distance(
'point',
Point(0, 0, srid=3857),
tolerance='0.05) = 1 OR 1=1 OR (1+1',
),
).filter(d=1).values('pk')
msg = 'The tolerance parameter has the wrong type'
with self.assertRaisesMessage(TypeError, msg):
qs.exists()
@skipUnless(
3
Source : tests.py
with Apache License 2.0
from gethue
with Apache License 2.0
from gethue
def test_distance_function_tolerance(self):
# Tolerance is greater than distance.
qs = AustraliaCity.objects.annotate(
d=Distance(
'point',
Point(151.23, -33.95, srid=4326),
tolerance=340.7,
),
).filter(d=0).values('pk')
self.assertIs(qs.exists(), True)
@no_oracle # Oracle already handles geographic distance calculation.
3
Source : tests.py
with Apache License 2.0
from gethue
with Apache License 2.0
from gethue
def test_distance_order_by(self):
qs = SouthTexasCity.objects.annotate(distance=Distance('point', Point(3, 3, srid=32140))).order_by(
'distance'
).values_list('name', flat=True).filter(name__in=('San Antonio', 'Pearland'))
self.assertSequenceEqual(qs, ['San Antonio', 'Pearland'])
@skipUnlessDBFeature("has_Length_function")
3
Source : tests.py
with Apache License 2.0
from gethue
with Apache License 2.0
from gethue
def _load_city_data(self):
for name, pnt_data in city_data:
City3D.objects.create(
name=name, point=Point(*pnt_data, srid=4326), pointg=Point(*pnt_data, srid=4326),
)
def _load_polygon_data(self):
3
Source : tests.py
with Apache License 2.0
from gethue
with Apache License 2.0
from gethue
def test_olmap_WMS_rendering(self):
geoadmin = admin.GeoModelAdmin(City, site)
result = geoadmin.get_map_widget(City._meta.get_field('point'))(
).render('point', Point(-79.460734, 40.18476))
self.assertIn(
"""geodjango_point.layers.base = new OpenLayers.Layer.WMS("OpenLayers WMS", """
""""http://vmap0.tiles.osgeo.org/wms/vmap0", {layers: 'basic', format: 'image/jpeg'});""",
result)
def test_olwidget_has_changed(self):
3
Source : test_expressions.py
with Apache License 2.0
from gethue
with Apache License 2.0
from gethue
def test_geometry_value_annotation(self):
p = Point(1, 1, srid=4326)
point = City.objects.annotate(p=Value(p, GeometryField(srid=4326))).first().p
self.assertEqual(point, p)
@skipUnlessDBFeature('supports_transform')
3
Source : test_expressions.py
with Apache License 2.0
from gethue
with Apache License 2.0
from gethue
def test_geometry_value_annotation_different_srid(self):
p = Point(1, 1, srid=32140)
point = City.objects.annotate(p=Value(p, GeometryField(srid=4326))).first().p
self.assertTrue(point.equals_exact(p.transform(4326, clone=True), 10 ** -5))
self.assertEqual(point.srid, 4326)
@skipUnless(postgis, 'Only postgis has geography fields.')
3
Source : test_functions.py
with Apache License 2.0
from gethue
with Apache License 2.0
from gethue
def test_difference(self):
geom = Point(5, 23, srid=4326)
qs = Country.objects.annotate(diff=functions.Difference('mpoly', geom))
# Oracle does something screwy with the Texas geometry.
if oracle:
qs = qs.exclude(name='Texas')
for c in qs:
self.assertTrue(c.mpoly.difference(geom).equals(c.diff))
@skipUnlessDBFeature("has_Difference_function", "has_Transform_function")
3
Source : test_functions.py
with Apache License 2.0
from gethue
with Apache License 2.0
from gethue
def test_difference_mixed_srid(self):
"""Testing with mixed SRID (Country has default 4326)."""
geom = Point(556597.4, 2632018.6, srid=3857) # Spherical mercator
qs = Country.objects.annotate(difference=functions.Difference('mpoly', geom))
# Oracle does something screwy with the Texas geometry.
if oracle:
qs = qs.exclude(name='Texas')
for c in qs:
self.assertTrue(c.mpoly.difference(geom).equals(c.difference))
@skipUnlessDBFeature("has_Envelope_function")
3
Source : test_functions.py
with Apache License 2.0
from gethue
with Apache License 2.0
from gethue
def test_intersection(self):
geom = Point(5, 23, srid=4326)
qs = Country.objects.annotate(inter=functions.Intersection('mpoly', geom))
for c in qs:
if spatialite or (mysql and not connection.ops.uses_invalid_empty_geometry_collection) or oracle:
# When the intersection is empty, some databases return None.
expected = None
else:
expected = c.mpoly.intersection(geom)
self.assertEqual(c.inter, expected)
@skipUnlessDBFeature("has_IsValid_function")
3
Source : test_functions.py
with Apache License 2.0
from gethue
with Apache License 2.0
from gethue
def test_sym_difference(self):
geom = Point(5, 23, srid=4326)
qs = Country.objects.annotate(sym_difference=functions.SymDifference('mpoly', geom))
# Oracle does something screwy with the Texas geometry.
if oracle:
qs = qs.exclude(name='Texas')
for country in qs:
self.assertTrue(country.mpoly.sym_difference(geom).equals(country.sym_difference))
@skipUnlessDBFeature("has_Transform_function")
3
Source : test_geos.py
with Apache License 2.0
from gethue
with Apache License 2.0
from gethue
def test_covers(self):
poly = Polygon(((0, 0), (0, 10), (10, 10), (10, 0), (0, 0)))
self.assertTrue(poly.covers(Point(5, 5)))
self.assertFalse(poly.covers(Point(100, 100)))
def test_closed(self):
3
Source : test_geos.py
with Apache License 2.0
from gethue
with Apache License 2.0
from gethue
def test_point_list_assignment(self):
p = Point(0, 0)
p[:] = (1, 2, 3)
self.assertEqual(p, Point(1, 2, 3))
p[:] = ()
self.assertEqual(p.wkt, Point())
p[:] = (1, 2)
self.assertEqual(p.wkt, Point(1, 2))
with self.assertRaises(ValueError):
p[:] = (1,)
with self.assertRaises(ValueError):
p[:] = (1, 2, 3, 4, 5)
def test_linestring_list_assignment(self):
3
Source : test_geos.py
with Apache License 2.0
from gethue
with Apache License 2.0
from gethue
def test_geometry_collection_list_assignment(self):
p = Point()
gc = GeometryCollection()
gc[:] = [p]
self.assertEqual(gc, GeometryCollection(p))
gc[:] = ()
self.assertEqual(gc, GeometryCollection())
def test_threed(self):
3
Source : test_geos.py
with Apache License 2.0
from gethue
with Apache License 2.0
from gethue
def test_threed(self):
"Testing three-dimensional geometries."
# Testing a 3D Point
pnt = Point(2, 3, 8)
self.assertEqual((2., 3., 8.), pnt.coords)
with self.assertRaises(TypeError):
pnt.tuple = (1., 2.)
pnt.coords = (1., 2., 3.)
self.assertEqual((1., 2., 3.), pnt.coords)
# Testing a 3D LineString
ls = LineString((2., 3., 8.), (50., 250., -117.))
self.assertEqual(((2., 3., 8.), (50., 250., -117.)), ls.tuple)
with self.assertRaises(TypeError):
ls.__setitem__(0, (1., 2.))
ls[0] = (1., 2., 3.)
self.assertEqual((1., 2., 3.), ls[0])
def test_distance(self):
3
Source : test_geos.py
with Apache License 2.0
from gethue
with Apache License 2.0
from gethue
def test_distance(self):
"Testing the distance() function."
# Distance to self should be 0.
pnt = Point(0, 0)
self.assertEqual(0.0, pnt.distance(Point(0, 0)))
# Distance should be 1
self.assertEqual(1.0, pnt.distance(Point(0, 1)))
# Distance should be ~ sqrt(2)
self.assertAlmostEqual(1.41421356237, pnt.distance(Point(1, 1)), 11)
# Distances are from the closest vertex in each geometry --
# should be 3 (distance from (2, 2) to (5, 2)).
ls1 = LineString((0, 0), (1, 1), (2, 2))
ls2 = LineString((5, 2), (6, 1), (7, 0))
self.assertEqual(3, ls1.distance(ls2))
def test_length(self):
3
Source : test_geos.py
with Apache License 2.0
from gethue
with Apache License 2.0
from gethue
def test_length(self):
"Testing the length property."
# Points have 0 length.
pnt = Point(0, 0)
self.assertEqual(0.0, pnt.length)
# Should be ~ sqrt(2)
ls = LineString((0, 0), (1, 1))
self.assertAlmostEqual(1.41421356237, ls.length, 11)
# Should be circumference of Polygon
poly = Polygon(LinearRing((0, 0), (0, 1), (1, 1), (1, 0), (0, 0)))
self.assertEqual(4.0, poly.length)
# Should be sum of each element's length in collection.
mpoly = MultiPolygon(poly.clone(), poly)
self.assertEqual(8.0, mpoly.length)
def test_emptyCollections(self):
3
Source : test_geos.py
with Apache License 2.0
from gethue
with Apache License 2.0
from gethue
def test_collection_dims(self):
gc = GeometryCollection([])
self.assertEqual(gc.dims, -1)
gc = GeometryCollection(Point(0, 0))
self.assertEqual(gc.dims, 0)
gc = GeometryCollection(LineString((0, 0), (1, 1)), Point(0, 0))
self.assertEqual(gc.dims, 1)
gc = GeometryCollection(LineString((0, 0), (1, 1)), Polygon(((0, 0), (0, 1), (1, 1), (0, 0))), Point(0, 0))
self.assertEqual(gc.dims, 2)
def test_collections_of_collections(self):
3
Source : test_geos.py
with Apache License 2.0
from gethue
with Apache License 2.0
from gethue
def test_extent(self):
"Testing `extent` method."
# The xmin, ymin, xmax, ymax of the MultiPoint should be returned.
mp = MultiPoint(Point(5, 23), Point(0, 0), Point(10, 50))
self.assertEqual((0.0, 0.0, 10.0, 50.0), mp.extent)
pnt = Point(5.23, 17.8)
# Extent of points is just the point itself repeated.
self.assertEqual((5.23, 17.8, 5.23, 17.8), pnt.extent)
# Testing on the 'real world' Polygon.
poly = fromstr(self.geometries.polygons[3].wkt)
ring = poly.shell
x, y = ring.x, ring.y
xmin, ymin = min(x), min(y)
xmax, ymax = max(x), max(y)
self.assertEqual((xmin, ymin, xmax, ymax), poly.extent)
def test_pickle(self):
3
Source : test_geos.py
with Apache License 2.0
from gethue
with Apache License 2.0
from gethue
def test_normalize(self):
g = MultiPoint(Point(0, 0), Point(2, 2), Point(1, 1))
self.assertIsNone(g.normalize())
self.assertTrue(g.equals_exact(MultiPoint(Point(2, 2), Point(1, 1), Point(0, 0))))
def test_empty_point(self):
3
Source : test_geos.py
with Apache License 2.0
from gethue
with Apache License 2.0
from gethue
def test_empty_point(self):
p = Point(srid=4326)
self.assertEqual(p.ogr.ewkt, p.ewkt)
self.assertEqual(p.transform(2774, clone=True), Point(srid=2774))
p.transform(2774)
self.assertEqual(p, Point(srid=2774))
@ignore_warnings(category=RemovedInDjango20Warning)
3
Source : test_geos.py
with Apache License 2.0
from gethue
with Apache License 2.0
from gethue
def test_deprecated_srid_getters_setters(self):
p = Point(1, 2, srid=123)
self.assertEqual(p.get_srid(), p.srid)
p.set_srid(321)
self.assertEqual(p.srid, 321)
@ignore_warnings(category=RemovedInDjango20Warning)
3
Source : test_geos.py
with Apache License 2.0
from gethue
with Apache License 2.0
from gethue
def test_deprecated_point_coordinate_getters_setters(self):
p = Point(1, 2, 3)
self.assertEqual((p.get_x(), p.get_y(), p.get_z()), (p.x, p.y, p.z))
p.set_x(3)
p.set_y(2)
p.set_z(1)
self.assertEqual((p.x, p.y, p.z), (3, 2, 1))
@ignore_warnings(category=RemovedInDjango20Warning)
3
Source : test_geos.py
with Apache License 2.0
from gethue
with Apache License 2.0
from gethue
def test_deprecated_point_tuple_getters_setters(self):
p = Point(1, 2, 3)
self.assertEqual(p.get_coords(), (p.x, p.y, p.z))
p.set_coords((3, 2, 1))
self.assertEqual(p.get_coords(), (3, 2, 1))
@ignore_warnings(category=RemovedInDjango20Warning)
See More Examples