mirror of
https://github.com/django/django.git
synced 2025-09-26 12:09:19 +00:00
Fixed #26512 -- Added tests for SpatialRefSysMixin.get_units().
This commit is contained in:
parent
5402f3ab09
commit
23fbd3ff48
2 changed files with 30 additions and 5 deletions
|
@ -164,15 +164,14 @@ class SpatialRefSysMixin(object):
|
|||
@classmethod
|
||||
def get_units(cls, wkt):
|
||||
"""
|
||||
Class method used by GeometryField on initialization to
|
||||
retrieve the units on the given WKT, without having to use
|
||||
any of the database fields.
|
||||
Return a tuple of (unit_value, unit_name) for the given WKT without
|
||||
using any of the database fields.
|
||||
"""
|
||||
if gdal.HAS_GDAL:
|
||||
return gdal.SpatialReference(wkt).units
|
||||
else:
|
||||
m = cls.units_regex.match(wkt)
|
||||
return m.group('unit'), m.group('unit_name')
|
||||
return float(m.group('unit')), m.group('unit_name')
|
||||
|
||||
@classmethod
|
||||
def get_spheroid(cls, wkt, string=True):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue