MCPcopy
hub / github.com/django/django / check_srs

Method check_srs

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

Check the compatibility of the given spatial reference object.

(self, source_srs)

Source from the content-addressed store, hash-verified

308 self.fields[field_name] = fields_val
309
310 def check_srs(self, source_srs):
311 "Check the compatibility of the given spatial reference object."
312
313 if isinstance(source_srs, SpatialReference):
314 sr = source_srs
315 elif isinstance(source_srs, self.spatial_backend.spatial_ref_sys()):
316 sr = source_srs.srs
317 elif isinstance(source_srs, (int, str)):
318 sr = SpatialReference(source_srs)
319 else:
320 # Otherwise just pulling the SpatialReference from the layer
321 sr = self.layer.srs
322
323 if not sr:
324 raise LayerMapError("No source reference system defined.")
325 else:
326 return sr
327
328 def check_unique(self, unique):
329 "Check the `unique` keyword parameter -- may be a sequence or string."

Callers 1

__init__Method · 0.95

Calls 3

SpatialReferenceClass · 0.90
LayerMapErrorClass · 0.85
spatial_ref_sysMethod · 0.45

Tested by

no test coverage detected