Return the coordinate transformation object.
(self)
| 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 | """ |
no test coverage detected