MCPcopy
hub / github.com/django/django / coord_transform

Method coord_transform

django/contrib/gis/utils/layermapping.py:521–537  ·  view source on GitHub ↗

Return the coordinate transformation object.

(self)

Source from the content-addressed store, hash-verified

519
520 # Other model methods.
521 def coord_transform(self):
522 "Return the coordinate transformation object."
523 SpatialRefSys = self.spatial_backend.spatial_ref_sys()
524 try:
525 # Getting the target spatial reference system
526 target_srs = (
527 SpatialRefSys.objects.using(self.using)
528 .get(srid=self.geo_field.srid)
529 .srs
530 )
531
532 # Creating the CoordTransform object
533 return CoordTransform(self.source_srs, target_srs)
534 except Exception as exc:
535 raise LayerMapError(
536 "Could not translate between the data source and model geometry."
537 ) from exc
538
539 def geometry_field(self):
540 """

Callers 1

__init__Method · 0.95

Calls 5

CoordTransformClass · 0.90
LayerMapErrorClass · 0.85
spatial_ref_sysMethod · 0.45
getMethod · 0.45
usingMethod · 0.45

Tested by

no test coverage detected