Ë
    ¥#ijh0  ã                   óª   — 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mZ  G d	„ d
e«      Z G d„ de
«      Z G d„ de
«      Zy)a6  
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)Úsrs)Úforce_bytesÚ	force_strc                   ó   — e Zd ZdZdZy)Ú	AxisOrderr   é   N)Ú__name__Ú
__module__Ú__qualname__ÚTRADITIONALÚ	AUTHORITY© ó    úU/var/www/html/office/venv/lib/python3.12/site-packages/django/contrib/gis/gdal/srs.pyr   r   (   s   „ Ø€KØ�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*y))Ú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."
    Nc                 ó¼  — t        |t        t        f«      st        d«      ‚|xs t        j                  | _        |dk(  r|t        j                  t        d«      «      | _	        | j                  |«       | j
                  t        j                  k(  r*t        j                  | j                  | j
                  «       yt        |t        «      r	 t        |«      }d|z  }n<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        j                  | j                  | j
                  «       |d
k(  r| j#                  |«       y|dk(  r| j%                  |«       yy# t        $ r Y ŒÀw xY w)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   NzEPSG:%dÚepsgÚogrzInvalid SRS type "%s"z+Could not create spatial reference from: %sÚuser)Ú
isinstancer   r   Ú
ValueErrorr   Ú
axis_orderÚcapiÚnew_srsr   ÚptrÚ
import_wktÚ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__6   s£  € ô ˜*¤x´Ð&;Ô<ÜØLóð ð %Ò=¬	×(=Ñ(=ˆŒØ�uÒÜ—|‘|¤H¨S£MÓ2ˆDŒHØ�O‰O˜IÔ&Ø�‰¤)×"7Ñ"7Ò7Ü×&Ñ& t§x¡x°·±ÔAØÜ˜	¤3Ô'ðô ˜9“~�Ø%¨Ñ,‘	ô ˜	¤3Ô'à‰HÜ˜	 4§=¡=Ô1ØˆCØ‰HäÐ3°hÑ>Ó?Ð?à�uÒà‰Cô ˜3“-ˆCÜ—,‘,˜sÓ#ˆCñ ÜØ=À	ÑIóð ð ˆDŒHà�?‰?œi×3Ñ3Ò3Ü×"Ñ" 4§8¡8¨T¯_©_Ô=à�vÒØ×"Ñ" 9Õ-Ø˜ÒØ×Ñ˜YÕ'ð  øôA ò Ùðús   ÃG Ç	GÇGc                 ób   — t        |t        «      r | j                  |Ž S | j                  |«      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©r-   Útargets     r   Ú__getitem__zSpatialReference.__getitem__q   s.   € ô8 �fœeÔ$Ø"�4—?‘? FÐ+Ð+à—?‘? 6Ó*Ð*r   c                 ó   — | j                   S )zUse 'pretty' WKT.)Ú
pretty_wkt©r-   s    r   Ú__str__zSpatialReference.__str__’   s   € à�‰Ð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   )r-   r7   Úindexs      r   r5   zSpatialReference.attr_value—   s:   € ô
 ˜&¤#Ô&¬j¸ÄÔ.DÜˆOÜ×"Ñ" 4§8¡8¬[¸Ó-@À%ÓHÐHr   c                 ód   — t        j                  | j                  |€|«      S t        |«      «      S )z;Return the authority name for the given string target node.)r"   Úget_auth_namer$   r   r6   s     r   Ú	auth_namezSpatialReference.auth_name    ó4   € ä×!Ñ!Ø�H‰H  �fó
ð 	
Ü4?ÀÓ4Gó
ð 	
r   c                 ód   — t        j                  | j                  |€|«      S t        |«      «      S )z;Return the authority code for the given string target node.)r"   Úget_auth_coder$   r   r6   s     r   Ú	auth_codezSpatialReference.auth_code¦   rC   r   c                 ój   — 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©xÓ 8ÀTÇ_Á_ÔUÐUr   c                 óB   — t        j                  | j                  «       y)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™XÕ&r   c                 óB   — t        j                  | j                  «       y)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   rN   zSpatialReference.identify_epsg´   s   € ô
 	×Ñ˜4Ÿ8™8Õ$r   c                 óB   — t        j                  | j                  «       y)z-Morph this SpatialReference to ESRI's format.N)r"   Úmorph_to_esrir$   r;   s    r   Úto_esrizSpatialReference.to_esri»   s   € ä×Ñ˜4Ÿ8™8Õ$r   c                 óB   — t        j                  | j                  «       y)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| j                  d«      S | j                  r| j                  d«      S | j                  r| j                  d«      S y)z*Return the name of this Spatial Reference.ÚPROJCSÚGEOGCSÚLOCAL_CSN)Ú	projectedr5   Ú
geographicÚlocalr;   s    r   ÚnamezSpatialReference.nameÄ   sI   € ð �>Š>Ø—?‘? 8Ó,Ð,Ø�_Š_Ø—?‘? 8Ó,Ð,Ø�ZŠZØ—?‘? :Ó.Ð.àr   c                 ód   — 	 t        | j                  d¬«      «      S # t        t        f$ r Y yw xY w)z=Return the SRID of top-level authority, or None if undefined.N)r7   )r(   rF   r*   r    r;   s    r   r0   zSpatialReference.sridÐ   s4   € ð	Ü�t—~‘~¨T�~Ó2Ó3Ð3øÜœ:Ð&ò 	Ùð	ús   ‚ �/®/c                 ón   — t        j                  | j                  t        t	        «       «      «      \  }}|S )z$Return the name of the linear units.©r"   Úlinear_unitsr$   r   r   ©r-   Úunitsr\   s      r   Úlinear_namezSpatialReference.linear_nameÙ   s*   € ô ×'Ñ'¨¯©´%¼»
Ó2CÓD‰ˆˆtØˆr   c                 ón   — t        j                  | j                  t        t	        «       «      «      \  }}|S )z%Return the value of the linear units.r_   ra   s      r   r`   zSpatialReference.linear_unitsß   s*   € ô ×'Ñ'¨¯©´%¼»
Ó2CÓD‰ˆˆtØˆr   c                 ón   — t        j                  | j                  t        t	        «       «      «      \  }}|S )z%Return the name of the angular units.©r"   Úangular_unitsr$   r   r   ra   s      r   Úangular_namezSpatialReference.angular_nameå   s*   € ô ×(Ñ(¨¯©´5¼»Ó3DÓE‰ˆˆtØˆr   c                 ón   — t        j                  | j                  t        t	        «       «      «      \  }}|S )z&Return the value of the angular units.rf   ra   s      r   rg   zSpatialReference.angular_unitsë   s*   € ô ×(Ñ(¨¯©´5¼»Ó3DÓE‰ˆˆtØˆr   c                 óH  — d\  }}| j                   s| j                  r5t        j                  | j                  t        t        «       «      «      \  }}n@| j                  r4t        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)
rY   r[   r"   r`   r$   r   r   rZ   rg   r   ra   s      r   rb   zSpatialReference.unitsñ   s|   € ð !‰ˆˆtØ�>Š>˜TŸZšZÜ×+Ñ+¨D¯H©H´e¼H»JÓ6GÓH‰KˆE‘4Ø�_Š_Ü×,Ñ,¨T¯X©X´u¼X»ZÓ7HÓI‰KˆE�4ØÐÜ˜T“?ˆDØ�tˆ}Ðr   c                 óH   — | 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Ñ2IÐJÐJr   c                 ód   — t        j                  | j                  t        t	        «       «      «      S )z6Return the Semi Major Axis for this Spatial Reference.)r"   rl   r$   r   r   r;   s    r   rl   zSpatialReference.semi_major	  ó   € ô �‰˜tŸx™x¬¬u«w«Ó8Ð8r   c                 ód   — t        j                  | j                  t        t	        «       «      «      S )z6Return the Semi Minor Axis for this Spatial Reference.)r"   rm   r$   r   r   r;   s    r   rm   zSpatialReference.semi_minor  rq   r   c                 ód   — t        j                  | j                  t        t	        «       «      «      S )z9Return the Inverse Flattening for this Spatial Reference.)r"   Úinvflatteningr$   r   r   r;   s    r   rn   z#SpatialReference.inverse_flattening  s!   € ô ×!Ñ! $§(¡(¬E´%³'«NÓ;Ð;r   c                 óR   — t        t        j                  | j                  «      «      S )zd
        Return True if this SpatialReference is geographic
         (root node is GEOGCS).
        )Úboolr"   Úisgeographicr$   r;   s    r   rZ   zSpatialReference.geographic  s   € ô ”D×%Ñ% d§h¡hÓ/Ó0Ð0r   c                 óR   — t        t        j                  | j                  «      «      S )zX
        Return True if this SpatialReference is local (root node is LOCAL_CS).
        )rv   r"   Úislocalr$   r;   s    r   r[   zSpatialReference.local!  s   € ô
 ”D—L‘L §¡Ó*Ó+Ð+r   c                 óR   — t        t        j                  | j                  «      «      S )zw
        Return True if this SpatialReference is a projected coordinate system
         (root node is PROJCS).
        )rv   r"   Úisprojectedr$   r;   s    r   rY   zSpatialReference.projected(  s   € ô ”D×$Ñ$ T§X¡XÓ.Ó/Ð/r   c                 óD   — t        j                  | j                  |«       y)z=Import the Spatial Reference from the EPSG code (an integer).N)r"   Ú	from_epsgr$   )r-   r   s     r   r,   zSpatialReference.import_epsg1  ó   € ä�‰�t—x‘x Õ&r   c                 óD   — t        j                  | j                  |«       y)z0Import the Spatial Reference from a PROJ string.N)r"   Ú	from_projr$   )r-   Úprojs     r   Úimport_projzSpatialReference.import_proj5  r~   r   c                 óV   — t        j                  | j                  t        |«      «       y)z>Import the Spatial Reference from the given user input string.N)r"   Úfrom_user_inputr$   r   )r-   Ú
user_inputs     r   r+   z"SpatialReference.import_user_input9  s   € ä×Ñ˜TŸX™X¤{°:Ó'>Õ?r   c           
      óz   — t        j                  | j                  t        t	        t        |«      «      «      «       y)z2Import the Spatial Reference from OGC WKT (string)N)r"   Úfrom_wktr$   r   r   r   )r-   r   s     r   r%   zSpatialReference.import_wkt=  s#   € ä�‰�d—h‘h¤¤h¬{¸3Ó/?Ó&@Ó AÕBr   c                 óD   — t        j                  | j                  |«       y)z0Import the Spatial Reference from an XML string.N)r"   Úfrom_xmlr$   )r-   Úxmls     r   Ú
import_xmlzSpatialReference.import_xmlA  s   € ä�‰�d—h‘h Õ$r   c                 ód   — 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.wktF  s    € ô �{‰{˜4Ÿ8™8¤U¬8«:Ó%6Ó7Ð7r   c                 óf   — t        j                  | j                  t        t	        «       «      |«      S )z.Return the 'pretty' representation of the WKT.)r"   Úto_pretty_wktr$   r   r   )r-   Úsimplifys     r   r:   zSpatialReference.pretty_wktK  s$   € ô ×!Ñ! $§(¡(¬E´(³*Ó,=¸xÓHÐHr   c                 ód   — 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.projP  s    € ô �|‰|˜DŸH™H¤e¬H«JÓ&7Ó8Ð8r   c                 ó   — | j                   S )zAlias for proj().)r�   r;   s    r   Úproj4zSpatialReference.proj4U  s   € ð �y‰yÐr   c                 óx   — t        j                  | j                  t        t	        «       «      t        |«      «      S )z8Return the XML representation of this Spatial Reference.)r"   Úto_xmlr$   r   r   r   )r-   Údialects     r   rŠ   zSpatialReference.xmlZ  s'   € ô �{‰{˜4Ÿ8™8¤U¬8«:Ó%6¼ÀGÓ8LÓMÐMr   )Ú r   N)r   )r˜   )+r   r   r   Ú__doc__r"   Úrelease_srsÚ
destructorr2   r8   r<   r5   rB   rF   rI   rL   rN   rQ   rT   Úpropertyr\   r0   rc   r`   rh   rg   rb   ro   rl   rm   rn   rZ   r[   rY   r,   r‚   r+   r%   r‹   r   r:   r�   r”   rŠ   r   r   r   r   r   -   sì  „ ñð ×!Ñ!€Jó9(òv+òBó
Iò
ò
òVò'ò%ò%ò$ð
 ñ	ó ð	ð ñó ðð ñó ðð
 ñó ðð
 ñó ðð
 ñó ðð
 ñó ðð ñKó ðKð ñ9ó ð9ð ñ9ó ð9ð ñ<ó ð<ð
 ñ1ó ð1ð ñ,ó ð,ð ñ0ó ð0ò'ò'ò@òCò%ð
 ñ8ó ð8ð òIó ðIð ñ9ó ð9ð ñó ðð òNó ñNr   r   c                   ó4   — e Zd ZdZej
                  Zd„ Zd„ Zy)ÚCoordTransformz,The coordinate system transformation object.c                 óü   — t        |t        «      rt        |t        «      st        d«      ‚t        j                  |j
                  |j
                  «      | _        |j                  | _        |j                  | _	        y)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)r-   Úsourcer7   s      r   r2   zCoordTransform.__init__e  sX   € ä˜&Ô"2Ô3¼:ØÔ$ô<
ô ÐPÓQÐQÜ—;‘;˜vŸ{™{¨F¯K©KÓ8ˆŒØ Ÿ+™+ˆŒØ Ÿ+™+ˆ�r   c                 ó<   — d| j                   ›d| j                  ›d�S )NzTransform from "z" to "ú")r¢   r£   r;   s    r   r<   zCoordTransform.__str__o  s   � Ø04·³ÀÇÃÐQÐQr   N)	r   r   r   r™   r"   Ú
destroy_ctr›   r2   r<   r   r   r   rž   rž   `  s   „ Ù2à—‘€Jò&óRr   rž   N)r™   Úctypesr   r   r   Úenumr   Útypesr   Údjango.contrib.gis.gdal.baser   Údjango.contrib.gis.gdal.errorr	   Ú"django.contrib.gis.gdal.prototypesr
   r"   Údjango.utils.encodingr   r   r   r   rž   r   r   r   ú<module>r¯      sO   ðñ÷: *Ñ )Ý Ý å 1Ý 6Ý :ß 8ô�ô ô
pN�xô pNôf	R�Xõ Rr   