https://t.me/RX1948
Server : Apache
System : Linux iad1-shared-b8-43 6.6.49-grsec-jammy+ #10 SMP Thu Sep 12 23:23:08 UTC 2024 x86_64
User : dh_edsupp ( 6597262)
PHP Version : 8.2.26
Disable Function : NONE
Directory :  /lib/python3/dist-packages/django/contrib/gis/gdal/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //lib/python3/dist-packages/django/contrib/gis/gdal/__pycache__/srs.cpython-310.pyc
o

3�aC1�@s�dZddlmZmZmZddlmZddlmZddl	m
Z
ddlmZddl
mZddlmZmZGd	d
�d
e�ZGdd�de�ZGd
d�de�ZdS)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)�GDALBase)�SRSException)�GDAL_VERSION)�srs)�force_bytes�	force_strc@seZdZdZdZdS)�	AxisOrderr�N)�__name__�
__module__�__qualname__�TRADITIONAL�	AUTHORITY�rr�=/usr/lib/python3/dist-packages/django/contrib/gis/gdal/srs.pyr'src@s�eZdZdZejZdLdd�Zdd�Zd	d
�Z	dMdd
�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zedd��Zedd��Zed d!��Zed"d#��Zed$d%��Zed&d'��Zed(d)��Zed*d+��Zed,d-��Zed.d/��Zed0d1��Zed2d3��Zed4d5��Zed6d7��Z d8d9�Z!d:d;�Z"d<d=�Z#d>d?�Z$d@dA�Z%edBdC��Z&edMdDdE��Z'edFdG��Z(edHdI��Z)edNdJdK��Z*dS)O�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."
    ��userNcCs�t|td�tf�s
td��|ptj|_|dkrKt�td��|_	|�
|�|jtjkr8tdkr8t�|j	|j�dS|jtjkrItdkrItd|j��dSt|t
�rdz
t|�}d|}Wn"tycYnwt|t�rld}nt||j�rw|}d	}ntd
|��|d	kr�|}n	td�}t�|�}|s�td|��||_	|jtjkr�tdkr�t�|j	|j�n|jtjkr�tdkr�td|j��|dkr�|�|�dS|dkr�|�|�dSdS)
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').
        Nz:SpatialReference.axis_order must be an AxisOrder instance.�wkt�)�rz"%s is not supported in GDAL < 3.0.zEPSG:%d�epsg�ogrzInvalid SRS type "%s"z+Could not create spatial reference from: %sr)�
isinstance�typer�
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	�bufrrr�__init__4sV�
�
�

�zSpatialReference.__init__cCst|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
        >>> print(srs['UNIT|AUTHORITY']) # For the units authority, have to use the pipe symbole.
        EPSG
        >>> print(srs['UNIT|AUTHORITY', 1]) # The authority value for the units
        9122
        )r�tuple�
attr_value�r,�targetrrr�__getitem__qs


zSpatialReference.__getitem__cC�|jS)zUse 'pretty' WKT.)�
pretty_wkt�r,rrr�__str__�szSpatialReference.__str__rcCs,t|t�r
t|t�st�t�|jt|�|�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.
        )rr&r'r)r!�get_attr_valuer#r
)r,r5�indexrrrr3�szSpatialReference.attr_valuecC�t�|jt|��S)z;Return the authority name for the given string target node.)r!�
get_auth_namer#r
r4rrr�	auth_name��zSpatialReference.auth_namecCr=)z;Return the authority code for the given string target node.)r!�
get_auth_coder#r
r4rrr�	auth_code�r@zSpatialReference.auth_codecCstt�|j�|jd�S)z/Return a clone of this SpatialReference object.)r )rr!�	clone_srsr#r r9rrr�clone��zSpatialReference.clonecC�t�|j�dS)z7Morph this SpatialReference from ESRI's format to EPSG.N)r!�morph_from_esrir#r9rrr�	from_esri��zSpatialReference.from_esricCrF)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#r9rrrrJ�szSpatialReference.identify_epsgcCrF)z-Morph this SpatialReference to ESRI's format.N)r!�
morph_to_esrir#r9rrr�to_esri�rIzSpatialReference.to_esricCrF)z5Check to see if the given spatial reference is valid.N)r!�srs_validater#r9rrr�validate�rIzSpatialReference.validatecCs4|jr|�d�S|jr|�d�S|jr|�d�SdS)z*Return the name of this Spatial Reference.�PROJCS�GEOGCS�LOCAL_CSN)�	projectedr3�
geographic�localr9rrr�name�s


zSpatialReference.namec	Cs,z	t|�dd��WSttfyYdSw)z=Return the SRID of top-level authority, or None if undefined.rr
N)r'r3r)rr9rrrr/�s
�zSpatialReference.sridcC�t�|jtt���\}}|S)z$Return the name of the linear units.�r!�linear_unitsr#rr�r,�unitsrUrrr�linear_name��zSpatialReference.linear_namecC�t�|jtt���\}}|S)z%Return the value of the linear units.rWrYrrrrX�r\zSpatialReference.linear_unitscCrV)z%Return the name of the angular units.�r!�
angular_unitsr#rrrYrrr�angular_name�r\zSpatialReference.angular_namecCr])z&Return the value of the angular units.r^rYrrrr_�r\zSpatialReference.angular_unitscCsdd\}}|js
|jrt�|jtt���\}}n|jr&t�|jtt���\}}|dur.t	|�}||fS)z�
        Return a 2-tuple of the units value and the units name. Automatically
        determine whether to return the linear or angular units.
        )NNN)
rRrTr!rXr#rrrSr_rrYrrrrZ�szSpatialReference.unitscCs|j|j|jfS)z
        Return a tuple of the ellipsoid parameters:
         (semimajor axis, semiminor axis, and inverse flattening)
        )�
semi_major�
semi_minor�inverse_flatteningr9rrr�	ellipsoid��zSpatialReference.ellipsoidcC�t�|jtt���S)z6Return the Semi Major Axis for this Spatial Reference.)r!rar#rrr9rrrra�zSpatialReference.semi_majorcCrf)z6Return the Semi Minor Axis for this Spatial Reference.)r!rbr#rrr9rrrrbrgzSpatialReference.semi_minorcCrf)z9Return the Inverse Flattening for this Spatial Reference.)r!�
invflatteningr#rrr9rrrrc
rgz#SpatialReference.inverse_flatteningcC�tt�|j��S)zd
        Return True if this SpatialReference is geographic
         (root node is GEOGCS).
        )�boolr!�isgeographicr#r9rrrrSrezSpatialReference.geographiccCri)zFReturn True if this SpatialReference is local (root node is LOCAL_CS).)rjr!�islocalr#r9rrrrTszSpatialReference.localcCri)zw
        Return True if this SpatialReference is a projected coordinate system
         (root node is PROJCS).
        )rjr!�isprojectedr#r9rrrrRrezSpatialReference.projectedcC�t�|j|�dS)z=Import the Spatial Reference from the EPSG code (an integer).N)r!�	from_epsgr#)r,rrrrr+&r@zSpatialReference.import_epsgcCrn)z0Import the Spatial Reference from a PROJ string.N)r!�	from_projr#)r,�projrrr�import_proj*r@zSpatialReference.import_projcCst�|jt|��dS)z>Import the Spatial Reference from the given user input string.N)r!�from_user_inputr#r
)r,�
user_inputrrrr*.rEz"SpatialReference.import_user_inputcCst�|jttt|����dS)z2Import the Spatial Reference from OGC WKT (string)N)r!�from_wktr#rrr
)r,rrrrr$2szSpatialReference.import_wktcCrn)z0Import the Spatial Reference from an XML string.N)r!�from_xmlr#)r,�xmlrrr�
import_xml6r@zSpatialReference.import_xmlcCrf)z8Return the WKT representation of this Spatial Reference.)r!�to_wktr#rrr9rrrr;rgzSpatialReference.wktcCst�|jtt��|�S)z.Return the 'pretty' representation of the WKT.)r!�
to_pretty_wktr#rr)r,�simplifyrrrr8@szSpatialReference.pretty_wktcCrf)z:Return the PROJ representation for this Spatial Reference.)r!�to_projr#rrr9rrrrqErgzSpatialReference.projcCr7)zAlias for proj().)rqr9rrr�proj4JszSpatialReference.proj4cCst�|jtt��t|��S)z8Return the XML representation of this Spatial Reference.)r!�to_xmlr#rrr
)r,�dialectrrrrwOszSpatialReference.xml)rrN)r)r)+rrr�__doc__r!�release_srs�
destructorr1r6r:r3r?rBrDrHrJrLrN�propertyrUr/r[rXr`r_rZrdrarbrcrSrTrRr+rrr*r$rxrr8rqr}rwrrrrr,sr
=
	
















rc@s&eZdZdZejZdd�Zdd�ZdS)�CoordTransformz,The coordinate system transformation object.cCsBt|t�r
t|t�std��t�|j|j�|_|j|_|j|_	dS)z;Initialize on a source and target SpatialReference objects.z2source and target must be of type SpatialReferenceN)
rrr)r!�new_ct�_ptrr#rU�
_srs1_name�
_srs2_name)r,�sourcer5rrrr1Ys
zCoordTransform.__init__cCsd|j|jfS)NzTransform from "%s" to "%s")r�r�r9rrrr:aszCoordTransform.__str__N)	rrrr�r!�
destroy_ctr�r1r:rrrrr�Us
r�N)r��ctypesrrr�enumr�django.contrib.gis.gdal.baser�django.contrib.gis.gdal.errorr�django.contrib.gis.gdal.libgdalr�"django.contrib.gis.gdal.prototypesr	r!�django.utils.encodingr
rrrr�rrrr�<module>s+

https://t.me/RX1948 - 2025