
    +{Bin                     0    d dl mZ d dlmZ  G d d      Zy)    )gdal)cached_propertyc                      e Zd ZdZed        Zed        Zed        Zed        Z	ed        Z
ed        Zed        Zed	        Zed
        Zed        Zed        Zed        Zed        Zed        Zedd       Zd Zy)SpatialRefSysMixinz~
    The SpatialRefSysMixin is a class used by the database-dependent
    SpatialRefSys objects to reduce redundant code.
    c           
      8   	 t        j                  | j                        S # t        $ r}|}Y d}~nd}~ww xY w	 t        j                  | j                        S # t        $ r}|}Y d}~nd}~ww xY wt        d| j                   d| d| j                   d|       )z8
        Return a GDAL SpatialReference object.
        Nz3Could not get OSR SpatialReference.
Error for WKT 'z': z
Error for PROJ.4 ')r   SpatialReferencewkt	Exception	proj4text)selfe	wkt_errorproj4_errors       _/var/www/python/venv/lib/python3.12/site-packages/django/contrib/gis/db/backends/base/models.pysrszSpatialRefSysMixin.srs   s    
	((22 	I		((88 	K	 "hhZs9+ 6!!% 0K=B
 	
s'   ! 	616A 	A."A))A.c                 .    | j                   j                  S )z
        Return a tuple of the ellipsoid parameters:
        (semimajor axis, semiminor axis, and inverse flattening).
        )r   	ellipsoidr   s    r   r   zSpatialRefSysMixin.ellipsoid    s     xx!!!    c                 .    | j                   j                  S )zReturn the projection name.)r   namer   s    r   r   zSpatialRefSysMixin.name(   s     xx}}r   c                      | j                   d   S )z4Return the spheroid name for this spatial reference.spheroidr   r   s    r   r   zSpatialRefSysMixin.spheroid-   s     xx
##r   c                      | j                   d   S )z,Return the datum for this spatial reference.datumr   r   s    r   r   zSpatialRefSysMixin.datum2   s     xx  r   c                 .    | j                   j                  S )z$Is this Spatial Reference projected?)r   	projectedr   s    r   r   zSpatialRefSysMixin.projected7   s     xx!!!r   c                 .    | j                   j                  S )z Is this Spatial Reference local?)r   localr   s    r   r    zSpatialRefSysMixin.local<   s     xx~~r   c                 .    | j                   j                  S )z%Is this Spatial Reference geographic?)r   
geographicr   s    r   r"   zSpatialRefSysMixin.geographicA   s     xx"""r   c                 .    | j                   j                  S )zReturn the linear units name.)r   linear_namer   s    r   r$   zSpatialRefSysMixin.linear_nameF   s     xx###r   c                 .    | j                   j                  S )zReturn the linear units.)r   linear_unitsr   s    r   r&   zSpatialRefSysMixin.linear_unitsK        xx$$$r   c                 .    | j                   j                  S )z%Return the name of the angular units.)r   angular_namer   s    r   r)   zSpatialRefSysMixin.angular_nameP   r'   r   c                 .    | j                   j                  S )zReturn the angular units.)r   angular_unitsr   s    r   r+   z SpatialRefSysMixin.angular_unitsU   s     xx%%%r   c                     | j                   s| j                  r| j                  | j                  fS | j                  r| j
                  | j                  fS y)z)Return a tuple of the units and the name.)NN)r   r    r&   r$   r"   r+   r)   r   s    r   unitszSpatialRefSysMixin.unitsZ   sI     >>TZZ%%t'7'788__&&(9(9::r   c                 @    t        j                  |      j                  S )z
        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_unitszSpatialRefSysMixin.get_unitsd   s     $$S)///r   c                     t        j                  |      }|j                  }|d   }|s||fS t        |      dk(  r|d   |d   }}n|\  }}d|d|d|dS )	z
        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_spheroidzSpatialRefSysMixin.get_spheroidl   sn     ##C(*o-- =!Q&%21%5}Q7G
%2"
-8&*MMr   c                 ,    t        | j                        S )zG
        Return the string representation, a 'pretty' OGC WKT.
        )strr   r   s    r   __str__zSpatialRefSysMixin.__str__   s     488}r   N)T)__name__
__module____qualname____doc__r   r   propertyr   r   r   r   r   r    r"   r$   r&   r)   r+   r-   classmethodr0   r<   r?    r   r   r   r      s:   
 
 
( " "   $ $ ! ! " "   # # $ $ % % % % & &     0 0 N N&r   r   N)django.contrib.gisr   django.utils.functionalr   r   rF   r   r   <module>rI      s    # 3 r   