
    h                     $    S SK Jr   " S S5      rg)    )gdalc                      \ rS rSrSr\S 5       r\S 5       r\S 5       r\S 5       r	\S 5       r
\S 5       r\S	 5       r\S
 5       r\S 5       r\S 5       r\S 5       r\S 5       r\S 5       r\S 5       r\SS j5       rS rSrg)SpatialRefSysMixin   zr
The SpatialRefSysMixin is a class used by the database-dependent
SpatialRefSys objects to reduce redundant code.
c                    [        U S5      (       a  U R                  R                  5       $  [        R                  " U R
                  5      U l        U R                  $ ! [         a  nUn SnAOSnAff = f [        R                  " U R                  5      U l        U R                  $ ! [         a  nUn SnAOSnAff = f[        SU R
                  < SU< 35      e)z(
Return a GDAL SpatialReference object.
_srsNz-Could not get OSR SpatialReference from WKT: z
Error:
)	hasattrr   cloner   SpatialReferencewktsrs	Exception	proj4text)selfemsgs      \/var/www/html/env/lib/python3.13/site-packages/django/contrib/gis/db/backends/base/models.pyr   SpatialRefSysMixin.srs
   s     4  99??$$
 11$((;	xx  11$..A	xx  88S" s/   0A 
A4(A//A480B) )
B?3B::B?c                 .    U R                   R                  $ )zg
Return a tuple of the ellipsoid parameters:
(semimajor axis, semiminor axis, and inverse flattening).
)r   	ellipsoidr   s    r   r   SpatialRefSysMixin.ellipsoid(   s     xx!!!    c                 .    U R                   R                  $ )zReturn the projection name.)r   namer   s    r   r   SpatialRefSysMixin.name0   s     xx}}r   c                      U R                   S   $ )z4Return the spheroid name for this spatial reference.spheroidr   r   s    r   r   SpatialRefSysMixin.spheroid5   s     xx
##r   c                      U R                   S   $ )z,Return the datum for this spatial reference.datumr   r   s    r   r"   SpatialRefSysMixin.datum:   s     xx  r   c                 .    U R                   R                  $ )z$Is this Spatial Reference projected?)r   	projectedr   s    r   r%   SpatialRefSysMixin.projected?   s     xx!!!r   c                 .    U R                   R                  $ )z Is this Spatial Reference local?)r   localr   s    r   r(   SpatialRefSysMixin.localD   s     xx~~r   c                 .    U R                   R                  $ )z%Is this Spatial Reference geographic?)r   
geographicr   s    r   r+   SpatialRefSysMixin.geographicI   s     xx"""r   c                 .    U R                   R                  $ )zReturn the linear units name.)r   linear_namer   s    r   r.   SpatialRefSysMixin.linear_nameN   s     xx###r   c                 .    U R                   R                  $ )zReturn the linear units.)r   linear_unitsr   s    r   r1   SpatialRefSysMixin.linear_unitsS        xx$$$r   c                 .    U R                   R                  $ )z%Return the name of the angular units.)r   angular_namer   s    r   r5   SpatialRefSysMixin.angular_nameX   r3   r   c                 .    U R                   R                  $ )zReturn the angular units.)r   angular_unitsr   s    r   r8    SpatialRefSysMixin.angular_units]   s     xx%%%r   c                     U R                   (       d  U R                  (       a  U R                  U R                  4$ U R                  (       a  U R
                  U R                  4$ g)z)Return a tuple of the units and the name.)NN)r%   r(   r1   r.   r+   r8   r5   r   s    r   unitsSpatialRefSysMixin.unitsb   sI     >>TZZ%%t'7'788__&&(9(9::r   c                 B    [         R                  " U5      R                  $ )zg
Return a tuple of (unit_value, unit_name) for the given WKT without
using any of the database fields.
)r   r   r;   )clsr   s     r   	get_unitsSpatialRefSysMixin.get_unitsl   s     $$S)///r   c                     [         R                  " U5      nUR                  nUS   nU(       d  XT4$ [        U5      S:X  a
  US   US   pvOUu  pgSU< SU< SU< S3$ )	zt
Class method used by GeometryField on initialization to
retrieve the `SPHEROID[..]` parameters from the given WKT.
r      r      z
SPHEROID["z",,])r   r   r   len)r>   r   stringr   sphere_paramssphere_nameradius
flattenings           r   get_spheroidSpatialRefSysMixin.get_spheroidt   sh     ##C(*o-- =!Q&%21%5}Q7G
%2"-8&*MMr   c                 ,    [        U R                  5      $ )z7
Return the string representation, a 'pretty' OGC WKT.
)strr   r   s    r   __str__SpatialRefSysMixin.__str__   s     488}r   )r   N)T)__name__
__module____qualname____firstlineno____doc__propertyr   r   r   r   r"   r%   r(   r+   r.   r1   r5   r8   r;   classmethodr?   rL   rP   __static_attributes__ r   r   r   r      s:   
  : " "   $ $ ! ! " "   # # $ $ % % % % & &     0 0 N N&r   r   N)django.contrib.gisr   r   rZ   r   r   <module>r\      s    #H Hr   