403Webshell
Server IP : 217.160.0.135  /  Your IP : 216.73.217.85
Web Server : Apache
System : Linux www 6.18.52-i1-ampere #1203 SMP Mon Sep 14 18:29:59 CEST 2026 aarch64
User : sws1074145052 ( 1074145052)
PHP Version : 8.3.32
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /lib/python3/dist-packages/django/contrib/gis/gdal/raster/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /lib/python3/dist-packages/django/contrib/gis/gdal/raster/__pycache__/source.cpython-311.pyc
�

�|�e-F���ddlZddlZddlZddlZddlmZmZmZmZm	Z	m
Z
mZmZddl
mZddlmZddlmZddlmZddlmZddlmZmZmZmZdd	lmZmZdd
l m!Z!ddl"m#Z#m$Z$ddl%m&Z&Gd
�de'��Z(Gd�de��Z)dS)�N)�	addressof�byref�c_buffer�c_char_p�c_double�c_int�c_void_p�	string_at)�Driver)�
GDALException)�raster��BandList)�GDALRasterBase)�GDAL_RESAMPLE_ALGORITHMS�VSI_DELETE_BUFFER_ON_READ�VSI_FILESYSTEM_BASE_PATH�VSI_TAKE_BUFFER_OWNERSHIP)�SpatialReference�SRSException)�
json_regex)�force_bytes�	force_str)�cached_propertyc���eZdZdddd�Z�fd�Zed���Zejd���Zed���Zejd	���Z�xZ	S)
�TransformPoint)r�)��)��)�origin�scale�skewc����|j|j|d}|j|j|d}t���||g��||_||_dS)Nrr)�geotransform�indices�super�__init__�_raster�_prop)�selfr
�prop�x�y�	__class__s     ��G/usr/lib/python3/dist-packages/django/contrib/gis/gdal/raster/source.pyr)zTransformPoint.__init__sc�������T� 2�1� 5�6������T� 2�1� 5�6��
�����!�Q�� � � ������
�
�
�c��|dS�Nr��r,s r1r.zTransformPoint.x&����A�w�r2c�l�|jj}|||j|jd<||j_dSr4�r*r&r'r+�r,�value�gtfs   r1r.zTransformPoint.x*�4���l�'��+0��D�L���$�Q�'�(�$'���!�!�!r2c��|dS�Nrr5r6s r1r/zTransformPoint.y0r7r2c�l�|jj}|||j|jd<||j_dSr?r9r:s   r1r/zTransformPoint.y4r=r2)
�__name__�
__module__�__qualname__r'r)�propertyr.�setterr/�
__classcell__�r0s@r1rrs�������������G����������X���X�(�(��X�(�
����X���X�(�(��X�(�(�(�(�(r2rc���eZdZdZejZd d�Z�fd�Zd�Z	d�Z
d�Zed���Z
ed	���Zed
���Zed���Zed���Zed
���Zed���Zejd���Zed���Zejd���Zed���Zejd���Zed���Zed���Zed���Zed���Zed���Zd!d�Zd"d�Z		d#d�Zed���Z �xZ!S)$�
GDALRasterz0
    Wrap a raster GDAL Data Source object.
    Fc���|rdnd|_tj��t|t��r(tj|��rtj|��}t|t��r�|�	t��s1tj�
|��std|z���	tjt#|��|j��|_dS#t$r(}td�||�����d}~wwxYwt|t(���rd|_t+j|��}t/|��|_tj�tt	t5j������}tjt#|��t;|j��|t<��	tjt#|��|j��|_dS#t$r1tjt#|����td���wxYwt|t@���rAd|_t|�!dd����}|j"dkr+d|vr'td	�|j"�����d
|vsd|vrtd���d
|vrtd���g}|�!di���#��D]T\}}	d�||	��}
|�$|
�%���&�����U|�$d��tOtQ|��z|�}tj)|jt#|�!dd����|d
|d|�!dtQ|�!dg������|�!dd��t;|����|_tU|�!dg����D]�\}}|j+|}
d|vr=|d|
_,|
j,�)d|vsd|vsd|vr|
�-|
j,fd���|
�-|�!d��|�!d��|�!d��|�!d�������|�!d
��|_.d|vr|d\|j/_0|j/_1d|vr|d\|j2_0|j2_1d |vr!|d \|j3_0|j3_1dSdSt|th��r	||_dStd!�tk|�������)"Nrrz(Unable to read raster source input "%s".z+Could not open the datasource at "{}" ({}).z1Failed creating VSI raster from the input buffer.�driver�MEM�namez5Specify name for creation of raster with driver "{}".�width�heightz;Specify width and height attributes for JSON or dict input.�sridz$Specify srid for JSON or dict input.�
papsz_optionsz{}={}��nr_of_bands�bands�datatype��nodata_value�data�size�shape)rr)rXrZ�offset)rXrYrZr[r"r#r$z%Invalid data source input type: "{}".)6�_writer�ensure_registered�
isinstance�strr�match�json�loads�
startswithr�os�path�existsr�capi�open_dsr�_ptr�format�bytes�sys�	getsizeofr�	_ds_input�join�uuid�uuid4�create_vsi_file_from_mem_bufferrr�unlink_vsi_file�dict�getrM�items�append�upper�encoder�len�	create_ds�	enumeraterTrWrX�srsr"r.r/r#r$r	�type)r,�ds_input�write�errrY�vsi_pathrKrQ�key�val�option�i�
band_input�bands              r1r)zGDALRaster.__init__As��� �'�a�a�a���� �"�"�"��h��$�$�	,��)9�(�)C�)C�	,��z�(�+�+�H��h��$�$�r	`��'�'�(@�A�A�
��G�N�N�8�,�,�
�$�>��I����
i� �L��X�)>�)>���L�L��	�	�	�� �
i�
i�
i�#�$Q�$X�$X�Ya�cf�$g�$g�h�h�h�����
i����
��%�
(�
(�e	`��D�K��=��*�*�D�&�h�/�/�D�N��w�|�|�$<�c�$�*�,�,�>O�>O�P�P�H��0��H�%�%��d�n�%�%��)�	
�
�
�
Y� �L��X�)>�)>���L�L��	�	�	�� �
Y�
Y�
Y��$�[��%:�%:�;�;�;�#�$W�X�X�X�
Y������$�
'�
'�L	`��D�K��H�L�L��5�9�9�:�:�F��{�e�#�#��h�(>�(>�#�$[�$b�$b�ci�cn�$o�$o�p�p�p��h�&�&�(�(�*B�*B�#�$a�b�b�b��X�%�%�#�$J�K�K�K��M�$�L�L��"�=�=�C�C�E�E�
>�
>���S� ����S�1�1���$�$�V�\�\�^�^�%:�%:�%<�%<�=�=�=�=�� � ��&�&�&�&��M�(:�(:�:�]�K�M������H�L�L���4�4�5�5���!���"����]�C����W�b�0I�0I�,J�,J�K�K����Z��+�+��m�$�$���D�I�"+�8�<�<���+D�+D�!E�!E�
�
�
��:��z�!�}��!�Z�/�/�(2�>�(B�D�%��(�4�"�*�4�4�"�j�0�0�#�z�1�1��	�	��(9�';�6�	�J�J�J��	�	�#����/�/�#����/�/�$�.�.��1�1�%�>�>�(�3�3�	����� �|�|�F�+�+�D�H��8�#�#�/7��/A�,���
�t�{�}��(�"�"�-5�g�->�*��
��d�j�l���!�!�+3�F�+;�(��	��T�Y�[�[�[�"�!�
��(�
+�
+�	`� �D�I�I�I�� G� N� N�t�T\�~�~� ^� ^�_�_�_s$�=,C+�+
D�5#D�D�$,H�;I
c���|jr&tjt|j����t�����dS�N)�is_vsi_basedrgrsrrMr(�__del__)r,r0s �r1r�zGDALRaster.__del__�sC�����	9�� ��T�Y�!7�!7�8�8�8�
���������r2c��|jSr�)rMr6s r1�__str__zGDALRaster.__str__�s
���y�r2c�J�dtt|j����zS)zJ
        Short-hand representation because WKB may be very large.
        z<Raster object at %s>)�hexrrir6s r1�__repr__zGDALRaster.__repr__�s!��'��Y�t�y�-A�-A�)B�)B�B�Br2c�d�|jstd���tj|j��dS)a

        Flush all data from memory into the source file if it exists.
        The data that needs flushing are geotransforms, coordinate systems,
        nodata_values and pixel values. This function will be called
        automatically wherever it is needed.
        z9Raster needs to be opened in write mode to change values.N)r\rrg�flush_dsrir6s r1�_flushzGDALRaster._flush�s6���{�	]�� [�\�\�\��
�d�i� � � � � r2c���|jsdSt��}tjt	|j��t
|��t��}t||j	��Sr�)
r�rrg�get_mem_buffer_from_vsi_filerrMrrr
r;)r,�
out_length�dats   r1�
vsi_bufferzGDALRaster.vsi_buffer�s]��� �	��4��W�W�
��/���	�"�"��*���%�
�
����j�.�/�/�/r2c�N�|jo|j�t��Sr�)rirMrcrr6s r1r�zGDALRaster.is_vsi_based�s ���y�K�T�Y�1�1�2J�K�K�Kr2c�N�ttj|j����S)zi
        Return the name of this raster. Corresponds to filename
        for file-based rasters.
        )rrg�get_ds_descriptionrir6s r1rMzGDALRaster.name�s����0���;�;�<�<�<r2c�R�tj|j��}t|��S)z>
        Return the GDAL Driver used for this raster.
        )rg�
get_ds_driverrir)r,�	ds_drivers  r1rKzGDALRaster.driver�s$��
�&�t�y�1�1�	��i� � � r2c�4�tj|j��S)z+
        Width (X axis) in pixels.
        )rg�get_ds_xsizerir6s r1rNzGDALRaster.width����
� ���+�+�+r2c�4�tj|j��S)z,
        Height (Y axis) in pixels.
        )rg�get_ds_ysizerir6s r1rOzGDALRaster.heightr�r2c��	tj|j��}|sdSt|d���S#t$rYdSwxYw)zF
        Return the SpatialReference used in this GDALRaster.
        N�wkt)�srs_type)rg�get_ds_projection_refrirr)r,r�s  r1r}zGDALRaster.srss[��
	��,�T�Y�7�7�C��
��t�#�C�%�8�8�8�8���	�	�	��4�4�	���s�0�0�
>�>c�6�t|t��r|}n;t|ttf��rt|��}nt	d���tj|j|j�	����|�
��dS)z�
        Set the spatial reference used in this GDALRaster. The input can be
        a SpatialReference or any parameter accepted by the SpatialReference
        constructor.
        z/Could not create a SpatialReference from input.N)r^r�intr_�
ValueErrorrg�set_ds_projection_refrir�ryr�)r,r;r}s   r1r}zGDALRaster.srss����e�-�.�.�	P��C�C�
���S�z�
*�
*�	P�"�5�)�)�C�C��N�O�O�O��"�4�9�c�g�n�n�.>�.>�?�?�?����
�
�
�
�
r2c��|jjS)zA
        Shortcut to access the srid of this GDALRaster.
        )r}rPr6s r1rPzGDALRaster.srid(s��
�x�}�r2c��||_dS)zE
        Shortcut to set this GDALRaster's srs from an srid.
        N)r})r,r;s  r1rPzGDALRaster.srid/s��
����r2c��tdz��}tj|jt	|����t|��S)z�
        Return the geotransform of the data source.
        Return the default geotransform if it does not exist or has not been
        set previously. The default is [0.0, 1.0, 0.0, 0.0, 0.0, -1.0].
        rV)rrg�get_ds_geotransformrir�list)r,r<s  r1r&zGDALRaster.geotransform6s:���!�|����� ���E�#�J�J�7�7�7��C�y�y�r2c�
�t|��dkstd�|D����std���tdz|�}t	j|jt|����|���dS)z)Set the geotransform for the data source.rVc3�NK�|] }t|ttf��V��!dSr�)r^r��float)�.0r.s  r1�	<genexpr>z*GDALRaster.geotransform.<locals>.<genexpr>Es0����&S�&S�q�z�!�c�5�\�'B�'B�&S�&S�&S�&S�&S�&Sr2z.Geotransform must consist of 6 numeric values.N)	rz�allr�rrg�set_ds_geotransformrirr�)r,�valuess  r1r&zGDALRaster.geotransformBsz���v�;�;�!���3�&S�&S�F�&S�&S�&S�#S�#S���M�N�N�N��Q�,��(��� ���E�&�M�M�:�:�:����
�
�
�
�
r2c�"�t|d��S)z3
        Coordinates of the raster origin.
        r"�rr6s r1r"zGDALRaster.originLs��
�d�H�-�-�-r2c�"�t|d��S)z@
        Pixel scale in units of the raster projection.
        r#r�r6s r1r#zGDALRaster.scaleSs��
�d�G�,�,�,r2c�"�t|d��S)z7
        Skew of pixels (rotation parameters).
        r$r�r6s r1r$zGDALRaster.skewZs��
�d�F�+�+�+r2c�b�|jj|jj|jzz}|jj|jj|jzz}t
||jj��}t||jj��}t
||jj��}t||jj��}||||fS)zJ
        Return the extent as a 4-tuple (xmin, ymin, xmax, ymax).
        )r"r.r#rNr/rO�min�max)r,�xval�yval�xmin�xmax�ymin�ymaxs       r1�extentzGDALRaster.extentas����{�}�t�z�|�d�j�8�8���{�}�t�z�|�d�k�9�9���4����'�'���4����'�'���4����'�'���4����'�'���T�4��%�%r2c� �t|��Sr�rr6s r1rTzGDALRaster.bandsqs����~�~�r2�NearestNeighbour�c
��|�d|j��|�d|j��|�d|jj��|�d|j��|�d|j��|�d|j��|�d|jj	��d|vr|j	d	z|jj	z|d<d
|vr"|j
d���|d
<d�|j
D��|d
<t|d���}t|}tj|j|jj���|j|jj���|d|t'��t'��t'���
�
|���|S)a

        Return a warped GDALRaster with the given input characteristics.

        The input is expected to be a dictionary containing the parameters
        of the target raster. Allowed values are width, height, SRID, origin,
        scale, skew, datatype, driver, and name (filename).

        By default, the warp functions keeps all parameters equal to the values
        of the original source raster. For the name of the target raster, the
        name of the source raster will be used and appended with
        _copy. + source_driver_name.

        In addition, the resampling algorithm can be specified with the "resampling"
        input parameter. The default is NearestNeighbor. For a list of all options
        consult the GDAL_RESAMPLE_ALGORITHMS constant.
        rNrOrPr"r#r$rKrM�_copy.rUrc� �g|]}d|ji��S�rWr�)r��bnds  r1�
<listcomp>z#GDALRaster.warp.<locals>.<listcomp>�s ��V�V�V�C�n�c�.>�?�V�V�Vr2rTT�r�r�)�
setdefaultrNrOr}rPr"r#r$rKrMrTrUrIrrg�reproject_imagerir�ryr	r�)r,r�
resampling�	max_error�target�	algorithms      r1�warpzGDALRaster.warpus���$	���G�T�Z�0�0�0����H�d�k�2�2�2����F�D�H�M�2�2�2����H�d�k�2�2�2����G�T�Z�0�0�0����F�D�I�.�.�.����H�d�k�&6�7�7�7���!�!�#�y�8�3�d�k�6F�F�H�V���X�%�%�#'�:�a�=�#9�#9�#;�#;�H�Z� �W�V�4�:�V�V�V�����H�D�1�1�1��-�Z�8�	�	
���I�t�x�|�*�*�,�,��K����.�.�0�0��s�I��J�J��
�
�H�J�J�		
�	
�	
�	�
�
�����
r2Nc���|r|}nk|jjdkr|jdz|jjz}nCtj�t
t
tj������}ttj|jjt|��|jt��t��t!��t!����|j���S)z"Return a clone of this GDALRaster.rLr�r�)rKrMrdrerorr_rprqrIrg�copy_dsrirrrr	r\)r,rM�
clone_names   r1�clonezGDALRaster.clone�s����	S��J�J�
�[�
��
&�
&���X�-���0@�@�J�J�����&>��D�J�L�L�@Q�@Q�R�R�J���L��� ��J�'�'��	�����
�
��
�
��
�
�
�
��+�
�
�
�	
r2c	��t|}t|t��r|}n;t|ttf��rt|��}ntd���|j|jkr'|r||jjkr|�	|��Stj|j|j
j���|j���||t!����}t#|��}|j|j|j|jj|jjg|jj|jjg|jj|jjgd�}	|r||	d<|r||	d<|�|	||���S)zk
        Return a copy of this raster reprojected into the given spatial
        reference system.
        zETransform only accepts SpatialReference, string, and integer objects.)rPrNrOr"r#r$rKrM)r�r�)rr^rr�r_�	TypeErrorrPrKrMr�rg�auto_create_warped_vrtrir}r�ryr	rIrNrOr"r.r/r#r$r�)
r,r}rKrMr�r�r��
target_srsr�rXs
          r1�	transformzGDALRaster.transform�sy��-�Z�8�	��c�+�,�,�	��J�J�
��c�3�Z�
(�
(�	�)�#�.�.�J�J�����
�
�?�d�i�'�'��'�6�T�[�EU�;U�;U��:�:�d�#�#�#��,��I�t�x�|�*�*�,�,�j�n�.C�.C�.E�.E��y�(�*�*�
�
���F�#�#���O��\��m��}���
��8��l�n�f�l�n�5��[�]�F�K�M�2�

�
���	$�#�D��N��	 ��D��L��y�y��*�	�y�J�J�Jr2c��tjstd���tj|jd�����S)z�
        Return information about this raster in a string format equivalent
        to the output of the gdalinfo command line utility.
        u5GDAL ≥ 2.1 is required for using the info property.N)rg�get_ds_infor��ptr�decoder6s r1�infozGDALRaster.info�s@����	V��T�U�U�U�����$�/�/�6�6�8�8�8r2)F)r�r�r�)NNr�r�)"rArBrC�__doc__rg�close_ds�
destructorr)r�r�r�r�rDr�rr�rMrKrNrOr}rErPr&r"r#r$r�rTr�r�r�r�rFrGs@r1rIrI;s������������J�|`�|`�|`�|`�|��������C�C�C�
!�
!�
!��0�0��X�0��L�L��_�L��=�=��X�=��!�!��_�!��,�,��X�,��,�,��X�,��
�
��X�
�	�Z�
�
��Z�
�����X��
�[����[���	�	��X�	���������.�.��X�.��-�-��X�-��,�,��X�,��
&�
&��X�
&�����X��5�5�5�5�n
�
�
�
�*AS��.K�.K�.K�.K�`�9�9��X�9�9�9�9�9r2rI)*rardrlrp�ctypesrrrrrrr	r
�django.contrib.gis.gdal.driverr�django.contrib.gis.gdal.errorr�"django.contrib.gis.gdal.prototypesr
rg�#django.contrib.gis.gdal.raster.bandr�#django.contrib.gis.gdal.raster.baser�$django.contrib.gis.gdal.raster.constrrrr�django.contrib.gis.gdal.srsrr�django.contrib.gis.geometryr�django.utils.encodingrr�django.utils.functionalrr�rrIr5r2r1�<module>r�s�������	�	�	�	�
�
�
�
�������������������������2�1�1�1�1�1�7�7�7�7�7�7�=�=�=�=�=�=�8�8�8�8�8�8�>�>�>�>�>�>�������������G�F�F�F�F�F�F�F�2�2�2�2�2�2�8�8�8�8�8�8�8�8�3�3�3�3�3�3� (� (� (� (� (�T� (� (� (�F~9�~9�~9�~9�~9��~9�~9�~9�~9�~9r2

Youez - 2016 - github.com/yon3zu
LinuXploit