§
    ¤”j2  ã                   óÊ   — d Z ddlmZmZmZ ddlmZ ddlmZ ddl	m
Z
 ddlmZ ddlmZ ddlmZ dd	lmZmZ  G d
„ de¦  «        Z G d„ de
¦  «        Z G d„ de
¦  «        ZdS )ah  
  The Spatial Reference class, represents OGR Spatial Reference objects.

  Example:
  >>> from django.contrib.gis.gdal import SpatialReference
  >>> srs = SpatialReference('WGS84')
  >>> print(srs)
  GEOGCS["WGS 84",
      DATUM["WGS_1984",
          SPHEROID["WGS 84",6378137,298.257223563,
              AUTHORITY["EPSG","7030"]],
          TOWGS84[0,0,0,0,0,0,0],
          AUTHORITY["EPSG","6326"]],
      PRIMEM["Greenwich",0,
          AUTHORITY["EPSG","8901"]],
      UNIT["degree",0.01745329251994328,
          AUTHORITY["EPSG","9122"]],
      AUTHORITY["EPSG","4326"]]
  >>> print(srs.proj)
  +proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs
  >>> print(srs.ellipsoid)
  (6378137.0, 6356752.3142451793, 298.25722356300003)
  >>> print(srs.projected, srs.geographic)
  False True
  >>> srs.import_epsg(32140)
  >>> print(srs.name)
  NAD83 / Texas South Central
é    )ÚbyrefÚc_char_pÚc_int)ÚIntEnum)ÚNoneType)ÚGDALBase)ÚSRSException)ÚGDAL_VERSION)Úsrs)Úforce_bytesÚ	force_strc                   ó   — e Zd ZdZdZdS )Ú	AxisOrderr   é   N)Ú__name__Ú
__module__Ú__qualname__ÚTRADITIONALÚ	AUTHORITY© ó    új/var/www/finuniver-perm.ru/html/portfolio/venv/lib/python3.11/site-packages/django/contrib/gis/gdal/srs.pyr   r   )   s   € € € € € Ø€KØ€I€I€Ir   r   c                   ó*  — e Zd ZdZej        Zd)d„Zd„ Zd„ Z	d*d	„Z
d
„ Zd„ Zd„ Zd„ Zd„ 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 d„ Z!d „ Z"d!„ Z#d"„ Z$d#„ Z%ed$„ ¦   «         Z&ed*d%„¦   «         Z'ed&„ ¦   «         Z(ed'„ ¦   «         Z)ed+d(„¦   «         Z*dS ),ÚSpatialReferencezé
    A wrapper for the OGRSpatialReference object. According to the GDAL web site,
    the SpatialReference object "provide[s] services to represent coordinate
    systems (projections and datums) and to transform between them."
    Ú ÚuserNc                 óä  — t          |t          t          f¦  «        st          d¦  «        ‚|pt          j        | _        |dk    r´t          j        t          d¦  «        ¦  «        | _	        |  
                    |¦  «         | j        t          j        k    r+t          dk    r t          j        | j	        | j        ¦  «         n7| j        t          j        k    r"t          dk     rt          d| j        z  ¦  «        ‚dS t          |t          ¦  «        r&	 t          |¦  «        }d|z  }nT# t          $ r Y nHw xY wt          |t          ¦  «        rd}n,t          || j        ¦  «        r|}d	}nt!          d
|z  ¦  «        ‚|d	k    r|}n#t          d¦  «        }t          j        |¦  «        }|st#          d|z  ¦  «        ‚|| _	        | j        t          j        k    r+t          dk    r t          j        | j	        | j        ¦  «         n7| j        t          j        k    r"t          dk     rt          d| j        z  ¦  «        ‚|dk    r|                      |¦  «         dS |dk    r|                      |¦  «         dS dS )a$  
        Create a GDAL OSR Spatial Reference object from the given input.
        The input may be string of OGC Well Known Text (WKT), an integer
        EPSG code, a PROJ string, and/or a projection "well known" shorthand
        string (one of 'WGS84', 'WGS72', 'NAD27', 'NAD83').
        z:SpatialReference.axis_order must be an AxisOrder instance.Úwktr   )é   r   z"%s is not supported in GDAL < 3.0.NzEPSG:%dÚepsgÚogrzInvalid SRS type "%s"z+Could not create spatial reference from: %sr   )Ú
isinstancer   r   Ú
ValueErrorr   Ú
axis_orderÚcapiÚnew_srsr   ÚptrÚ
import_wktr
   Úset_axis_strategyÚstrÚintÚptr_typeÚ	TypeErrorr	   Úimport_user_inputÚimport_epsg)ÚselfÚ	srs_inputÚsrs_typer$   Úsridr   Úbufs          r   Ú__init__zSpatialReference.__init__7   s�  € õ ˜*¥xµÐ&;Ñ<Ô<ð 	ÝØLñô ð ð %Ð=­	Ô(=ˆŒØ�uÒÐÝ”|¥H¨S¡M¤MÑ2Ô2ˆDŒHØ�OŠO˜IÑ&Ô&Ð&ØŒ¥)Ô"7Ò7Ð7½LÈFÒ<RÐ<RÝÔ& t¤x°´ÑAÔAÐAÐAØ”¥IÔ$9Ò9Ð9½lÈVÒ>SÐ>SÝ Ð!EÈÌÑ!WÑXÔXÐXØˆFÝ˜	¥3Ñ'Ô'ð 	@ðõ ˜9‘~”~�Ø%¨Ñ,�	�	øÝð ð ð Ø�ðøøøå˜	¥3Ñ'Ô'ð 	@àˆHˆHÝ˜	 4¤=Ñ1Ô1ð 	@ØˆCØˆHˆHåÐ3°hÑ>Ñ?Ô?Ð?à�uÒÐàˆCˆCõ ˜3‘-”-ˆCÝ”,˜sÑ#Ô#ˆCð ð 	ÝØ=À	ÑIñô ð ð ˆDŒHàŒ?�iÔ3Ò3Ð3½ÈÒ8NÐ8NÝÔ" 4¤8¨T¬_Ñ=Ô=Ð=Ð=ØŒ_¥	Ô 5Ò5Ð5½,ÈÒ:OÐ:OÝÐAÀDÄOÑSÑTÔTÐTà�vÒÐØ×"Ò" 9Ñ-Ô-Ð-Ð-Ð-Ø˜ÒÐØ×Ò˜YÑ'Ô'Ð'Ð'Ð'ð  Ðs   ÄD$ Ä$
D1Ä0D1c                 ój   — t          |t          ¦  «        r
 | j        |Ž S |                      |¦  «        S )a“  
        Return the value of the given string attribute node, None if the node
        doesn't exist.  Can also take a tuple as a parameter, (target, child),
        where child is the index of the attribute in the WKT.  For example:

        >>> wkt = 'GEOGCS["WGS 84", DATUM["WGS_1984, ... AUTHORITY["EPSG","4326"]]'
        >>> srs = SpatialReference(wkt) # could also use 'WGS84', or 4326
        >>> print(srs['GEOGCS'])
        WGS 84
        >>> print(srs['DATUM'])
        WGS_1984
        >>> print(srs['AUTHORITY'])
        EPSG
        >>> print(srs['AUTHORITY', 1]) # The authority value
        4326
        >>> print(srs['TOWGS84', 4]) # the fourth value in this wkt
        0
        >>> # For the units authority, have to use the pipe symbole.
        >>> print(srs['UNIT|AUTHORITY'])
        EPSG
        >>> print(srs['UNIT|AUTHORITY', 1]) # The authority value for the units
        9122
        )r"   ÚtupleÚ
attr_value©r0   Útargets     r   Ú__getitem__zSpatialReference.__getitem__v   s7   € õ0 �f�eÑ$Ô$ð 	+Ø"�4”? FÐ+Ð+à—?’? 6Ñ*Ô*Ð*r   c                 ó   — | j         S )zUse 'pretty' WKT.)Ú
pretty_wkt©r0   s    r   Ú__str__zSpatialReference.__str__“   s
   € àŒÐr   r   c                 ó´   — t          |t          ¦  «        rt          |t          ¦  «        st          ‚t	          j        | j        t          |¦  «        |¦  «        S )zš
        The attribute value for the given target node (e.g. 'PROJCS'). The index
        keyword specifies an index of the child node to return.
        )r"   r*   r+   r-   r%   Úget_attr_valuer'   r   )r0   r:   Úindexs      r   r8   zSpatialReference.attr_value˜   sK   € õ
 ˜&¥#Ñ&Ô&ð 	­j¸ÅÑ.DÔ.Dð 	ÝˆOÝÔ" 4¤8­[¸Ñ-@Ô-@À%ÑHÔHÐHr   c                 óX   — t          j        | j        |€|nt          |¦  «        ¦  «        S )z;Return the authority name for the given string target node.)r%   Úget_auth_namer'   r   r9   s     r   Ú	auth_namezSpatialReference.auth_name¡   ó.   € åÔ!ØŒH  �f�fµKÀÑ4GÔ4Gñ
ô 
ð 	
r   c                 óX   — t          j        | j        |€|nt          |¦  «        ¦  «        S )z;Return the authority code for the given string target node.)r%   Úget_auth_coder'   r   r9   s     r   Ú	auth_codezSpatialReference.auth_code§   rF   r   c                 ó\   — t          t          j        | j        ¦  «        | j        ¬¦  «        S )z/Return a clone of this SpatialReference object.)r$   )r   r%   Ú	clone_srsr'   r$   r>   s    r   ÚclonezSpatialReference.clone­   s#   € å¥¤¨t¬xÑ 8Ô 8ÀTÄ_ÐUÑUÔUÐUr   c                 ó8   — t          j        | j        ¦  «         dS )z7Morph this SpatialReference from ESRI's format to EPSG.N)r%   Úmorph_from_esrir'   r>   s    r   Ú	from_esrizSpatialReference.from_esri±   s   € åÔ˜TœXÑ&Ô&Ð&Ð&Ð&r   c                 ó8   — t          j        | j        ¦  «         dS )zš
        This method inspects the WKT of this SpatialReference, and will
        add EPSG authority nodes where an EPSG identifier is applicable.
        N)r%   Úidentify_epsgr'   r>   s    r   rQ   zSpatialReference.identify_epsgµ   s   € õ
 	Ô˜4œ8Ñ$Ô$Ð$Ð$Ð$r   c                 ó8   — t          j        | j        ¦  «         dS )z-Morph this SpatialReference to ESRI's format.N)r%   Úmorph_to_esrir'   r>   s    r   Úto_esrizSpatialReference.to_esri¼   s   € åÔ˜4œ8Ñ$Ô$Ð$Ð$Ð$r   c                 ó8   — t          j        | j        ¦  «         dS )z5Check to see if the given spatial reference is valid.N)r%   Úsrs_validater'   r>   s    r   ÚvalidatezSpatialReference.validateÀ   s   € åÔ˜$œ(Ñ#Ô#Ð#Ð#Ð#r   c                 ó®   — | j         r|                      d¦  «        S | j        r|                      d¦  «        S | j        r|                      d¦  «        S dS )z*Return the name of this Spatial Reference.ÚPROJCSÚGEOGCSÚLOCAL_CSN)Ú	projectedr8   Ú
geographicÚlocalr>   s    r   ÚnamezSpatialReference.nameÅ   s]   € ð Œ>ð 	Ø—?’? 8Ñ,Ô,Ð,ØŒ_ð 	Ø—?’? 8Ñ,Ô,Ð,ØŒZð 	Ø—?’? :Ñ.Ô.Ð.à�4r   c                 óz   — 	 t          |                      d¬¦  «        ¦  «        S # t          t          f$ r Y dS w xY w)z=Return the SRID of top-level authority, or None if undefined.N)r:   )r+   rI   r-   r#   r>   s    r   r3   zSpatialReference.sridÑ   sJ   € ð	Ý�t—~’~¨T�~Ñ2Ô2Ñ3Ô3Ð3øÝ�:Ð&ð 	ð 	ð 	Ø�4�4ð	øøøs   ‚"% ¥:¹:c                 ór   — t          j        | j        t          t	          ¦   «         ¦  «        ¦  «        \  }}|S )z$Return the name of the linear units.©r%   Úlinear_unitsr'   r   r   ©r0   Úunitsr_   s      r   Úlinear_namezSpatialReference.linear_nameÚ   s-   € õ Ô'¨¬µ%½¹
¼
Ñ2CÔ2CÑDÔD‰ˆˆtØˆr   c                 ór   — t          j        | j        t          t	          ¦   «         ¦  «        ¦  «        \  }}|S )z%Return the value of the linear units.rb   rd   s      r   rc   zSpatialReference.linear_unitsà   s-   € õ Ô'¨¬µ%½¹
¼
Ñ2CÔ2CÑDÔD‰ˆˆtØˆr   c                 ór   — t          j        | j        t          t	          ¦   «         ¦  «        ¦  «        \  }}|S )z%Return the name of the angular units.©r%   Úangular_unitsr'   r   r   rd   s      r   Úangular_namezSpatialReference.angular_nameæ   s-   € õ Ô(¨¬µ5½¹¼Ñ3DÔ3DÑEÔE‰ˆˆtØˆr   c                 ór   — t          j        | j        t          t	          ¦   «         ¦  «        ¦  «        \  }}|S )z&Return the value of the angular units.ri   rd   s      r   rj   zSpatialReference.angular_unitsì   s-   € õ Ô(¨¬µ5½¹¼Ñ3DÔ3DÑEÔE‰ˆˆtØˆr   c                 ó:  — d\  }}| j         s| j        r7t          j        | j        t          t          ¦   «         ¦  «        ¦  «        \  }}n=| j        r6t          j        | j        t          t          ¦   «         ¦  «        ¦  «        \  }}|�t          |¦  «        }||fS )z˜
        Return a 2-tuple of the units value and the units name. Automatically
        determine whether to return the linear or angular units.
        )NN)
r\   r^   r%   rc   r'   r   r   r]   rj   r   rd   s      r   re   zSpatialReference.unitsò   s’   € ð !‰ˆˆtØŒ>ð 	J˜TœZð 	JÝÔ+¨D¬Hµe½H¹J¼JÑ6GÔ6GÑHÔH‰KˆE�4�4ØŒ_ð 	JÝÔ,¨T¬Xµu½X¹Z¼ZÑ7HÔ7HÑIÔI‰KˆE�4ØÐÝ˜T‘?”?ˆDØ�tˆ}Ðr   c                 ó*   — | j         | j        | j        fS )z
        Return a tuple of the ellipsoid parameters:
         (semimajor axis, semiminor axis, and inverse flattening)
        )Ú
semi_majorÚ
semi_minorÚinverse_flatteningr>   s    r   Ú	ellipsoidzSpatialReference.ellipsoid  s   € ð ” ¤°$Ô2IÐJÐJr   c                 óh   — t          j        | j        t          t	          ¦   «         ¦  «        ¦  «        S )z6Return the Semi Major Axis for this Spatial Reference.)r%   ro   r'   r   r   r>   s    r   ro   zSpatialReference.semi_major
  ó"   € õ Œ˜tœx­­u©w¬w©¬Ñ8Ô8Ð8r   c                 óh   — t          j        | j        t          t	          ¦   «         ¦  «        ¦  «        S )z6Return the Semi Minor Axis for this Spatial Reference.)r%   rp   r'   r   r   r>   s    r   rp   zSpatialReference.semi_minor  rt   r   c                 óh   — t          j        | j        t          t	          ¦   «         ¦  «        ¦  «        S )z9Return the Inverse Flattening for this Spatial Reference.)r%   Úinvflatteningr'   r   r   r>   s    r   rq   z#SpatialReference.inverse_flattening  s#   € õ Ô! $¤(­Eµ%±'´'©N¬NÑ;Ô;Ð;r   c                 óN   — t          t          j        | j        ¦  «        ¦  «        S )zd
        Return True if this SpatialReference is geographic
         (root node is GEOGCS).
        )Úboolr%   Úisgeographicr'   r>   s    r   r]   zSpatialReference.geographic  s   € õ •DÔ% d¤hÑ/Ô/Ñ0Ô0Ð0r   c                 óN   — t          t          j        | j        ¦  «        ¦  «        S )zFReturn True if this SpatialReference is local (root node is LOCAL_CS).)ry   r%   Úislocalr'   r>   s    r   r^   zSpatialReference.local"  s   € õ •D”L ¤Ñ*Ô*Ñ+Ô+Ð+r   c                 óN   — t          t          j        | j        ¦  «        ¦  «        S )zw
        Return True if this SpatialReference is a projected coordinate system
         (root node is PROJCS).
        )ry   r%   Úisprojectedr'   r>   s    r   r\   zSpatialReference.projected'  s   € õ •DÔ$ T¤XÑ.Ô.Ñ/Ô/Ð/r   c                 ó:   — t          j        | j        |¦  «         dS )z=Import the Spatial Reference from the EPSG code (an integer).N)r%   Ú	from_epsgr'   )r0   r    s     r   r/   zSpatialReference.import_epsg0  ó   € åŒ�t”x Ñ&Ô&Ð&Ð&Ð&r   c                 ó:   — t          j        | j        |¦  «         dS )z0Import the Spatial Reference from a PROJ string.N)r%   Ú	from_projr'   )r0   Úprojs     r   Úimport_projzSpatialReference.import_proj4  r�   r   c                 óT   — t          j        | j        t          |¦  «        ¦  «         dS )z>Import the Spatial Reference from the given user input string.N)r%   Úfrom_user_inputr'   r   )r0   Ú
user_inputs     r   r.   z"SpatialReference.import_user_input8  s%   € åÔ˜TœX¥{°:Ñ'>Ô'>Ñ?Ô?Ð?Ð?Ð?r   c           
      óˆ   — t          j        | j        t          t	          t          |¦  «        ¦  «        ¦  «        ¦  «         dS )z2Import the Spatial Reference from OGC WKT (string)N)r%   Úfrom_wktr'   r   r   r   )r0   r   s     r   r(   zSpatialReference.import_wkt<  s4   € åŒ�d”h¥¥h­{¸3Ñ/?Ô/?Ñ&@Ô&@Ñ AÔ AÑBÔBÐBÐBÐBr   c                 ó:   — t          j        | j        |¦  «         dS )z0Import the Spatial Reference from an XML string.N)r%   Úfrom_xmlr'   )r0   Úxmls     r   Ú
import_xmlzSpatialReference.import_xml@  s   € åŒ�d”h Ñ$Ô$Ð$Ð$Ð$r   c                 óh   — t          j        | j        t          t	          ¦   «         ¦  «        ¦  «        S )z8Return the WKT representation of this Spatial Reference.)r%   Úto_wktr'   r   r   r>   s    r   r   zSpatialReference.wktE  s$   € õ Œ{˜4œ8¥U­8©:¬:Ñ%6Ô%6Ñ7Ô7Ð7r   c                 ój   — t          j        | j        t          t	          ¦   «         ¦  «        |¦  «        S )z.Return the 'pretty' representation of the WKT.)r%   Úto_pretty_wktr'   r   r   )r0   Úsimplifys     r   r=   zSpatialReference.pretty_wktJ  s'   € õ Ô! $¤(­Eµ(±*´*Ñ,=Ô,=¸xÑHÔHÐHr   c                 óh   — t          j        | j        t          t	          ¦   «         ¦  «        ¦  «        S )z:Return the PROJ representation for this Spatial Reference.)r%   Úto_projr'   r   r   r>   s    r   r„   zSpatialReference.projO  s$   € õ Œ|˜DœH¥e­H©J¬JÑ&7Ô&7Ñ8Ô8Ð8r   c                 ó   — | j         S )zAlias for proj().)r„   r>   s    r   Úproj4zSpatialReference.proj4T  s   € ð ŒyÐr   c                 ó„   — t          j        | j        t          t	          ¦   «         ¦  «        t          |¦  «        ¦  «        S )z8Return the XML representation of this Spatial Reference.)r%   Úto_xmlr'   r   r   r   )r0   Údialects     r   r�   zSpatialReference.xmlY  s.   € õ Œ{˜4œ8¥U­8©:¬:Ñ%6Ô%6½ÀGÑ8LÔ8LÑMÔMÐMr   )r   r   N)r   )r   )+r   r   r   Ú__doc__r%   Úrelease_srsÚ
destructorr5   r;   r?   r8   rE   rI   rL   rO   rQ   rT   rW   Úpropertyr_   r3   rf   rc   rk   rj   re   rr   ro   rp   rq   r]   r^   r\   r/   r…   r.   r(   rŽ   r   r=   r„   r—   r�   r   r   r   r   r   .   sH  € € € € € ðð ð Ô!€Jð=(ð =(ð =(ð =(ð~+ð +ð +ð:ð ð ð
Ið Ið Ið Ið
ð 
ð 
ð
ð 
ð 
ðVð Vð Vð'ð 'ð 'ð%ð %ð %ð%ð %ð %ð$ð $ð $ð
 ð	ð 	ñ „Xð	ð ðð ñ „Xðð ðð ñ „Xðð
 ðð ñ „Xðð
 ðð ñ „Xðð
 ðð ñ „Xðð
 ðð ñ „Xðð ðKð Kñ „XðKð ð9ð 9ñ „Xð9ð ð9ð 9ñ „Xð9ð ð<ð <ñ „Xð<ð
 ð1ð 1ñ „Xð1ð ð,ð ,ñ „Xð,ð ð0ð 0ñ „Xð0ð'ð 'ð 'ð'ð 'ð 'ð@ð @ð @ðCð Cð Cð%ð %ð %ð
 ð8ð 8ñ „Xð8ð ðIð Ið Iñ „XðIð ð9ð 9ñ „Xð9ð ðð ñ „Xðð ðNð Nð Nñ „XðNð Nð Nr   r   c                   ó,   — e Zd ZdZej        Zd„ Zd„ ZdS )ÚCoordTransformz,The coordinate system transformation object.c                 óð   — t          |t          ¦  «        rt          |t          ¦  «        st          d¦  «        ‚t          j        |j        |j        ¦  «        | _        |j        | _        |j        | _	        dS )z;Initialize on a source and target SpatialReference objects.z2source and target must be of type SpatialReferenceN)
r"   r   r-   r%   Únew_ctÚ_ptrr'   r_   Ú
_srs1_nameÚ
_srs2_name)r0   Úsourcer:   s      r   r5   zCoordTransform.__init__c  sl   € å˜&Õ"2Ñ3Ô3ð 	R½:ØÕ$ñ<
ô <
ð 	Rõ ÐPÑQÔQÐQÝ”;˜vœ{¨F¬KÑ8Ô8ˆŒØ œ+ˆŒØ œ+ˆŒˆˆr   c                 ó(   — d| j         ›d| j        ›d�S )NzTransform from "z" to "ú")r¤   r¥   r>   s    r   r?   zCoordTransform.__str__m  s   € € Ø04´°°ÀÄÀÀÐQÐQr   N)	r   r   r   r›   r%   Ú
destroy_ctr�   r5   r?   r   r   r   r    r    _  sD   € € € € € Ø2Ð2Ø”€Jð&ð &ð &ðRð Rð Rð Rð Rr   r    N)r›   Úctypesr   r   r   Úenumr   Útypesr   Údjango.contrib.gis.gdal.baser   Údjango.contrib.gis.gdal.errorr	   Údjango.contrib.gis.gdal.libgdalr
   Ú"django.contrib.gis.gdal.prototypesr   r%   Údjango.utils.encodingr   r   r   r   r    r   r   r   ú<module>r²      sV  ððð ð: *Ð )Ð )Ð )Ð )Ð )Ð )Ð )Ð )Ð )Ø Ð Ð Ð Ð Ð Ø Ð Ð Ð Ð Ð à 1Ð 1Ð 1Ð 1Ð 1Ð 1Ø 6Ð 6Ð 6Ð 6Ð 6Ð 6Ø 8Ð 8Ð 8Ð 8Ð 8Ð 8Ø :Ð :Ð :Ð :Ð :Ð :Ø 8Ð 8Ð 8Ð 8Ð 8Ð 8Ð 8Ð 8ðð ð ð ð �ñ ô ð ð
nNð nNð nNð nNð nN�xñ nNô nNð nNðb	Rð Rð Rð Rð R�Xñ Rô Rð Rð Rð Rr   