B
    ¥0H[Æ  ã               @   s,   d dl mZ d dlmZ G dd„ deƒZdS )é    )ÚGDALBase)Úrasterc               @   s*   e Zd ZdZedd„ ƒZejdd„ ƒZdS )ÚGDALRasterBasez@
    Attributes that exist on both GDALRaster and GDALBand.
    c             C   sð   t jstdƒ‚dg}t  | j¡}|rXd}|| }x&|rV| | ¡ ¡ |d7 }|| }q2W t  |¡ i }x„|D ]|}t  | j|dkr„dn| ¡ ¡}|s”qli }d}|| }x2|rÖ| ¡  	d¡\}	}
|
||	< |d7 }|| }q¦W |||rä|nd< qlW |S )zô
        Return the metadata for this raster or band. The return value is a
        nested dictionary, where the first-level key is the metadata domain and
        the second-level is the metadata item names and values for that domain.
        u:   GDAL â‰¥ 1.11 is required for using the metadata property.ÚDEFAULTr   é   Nú=)
ÚcapiZget_ds_metadata_domain_listÚ
ValueErrorÚ_ptrÚappendÚdecodeZfree_dslZget_ds_metadataÚencodeÚsplit)ÚselfZdomain_listZ	meta_listÚcounterÚdomainÚresultÚdataZdomain_metaÚitemÚkeyÚval© r   úgC:\Users\HIRONO~1\AppData\Local\Temp\pip-install-6bm3nxem\django\django\contrib\gis\gdal\raster\base.pyÚmetadata	   s:    

zGDALRasterBase.metadatac             C   sf   x`|  ¡ D ]T\}}|dkrdn| ¡ }x6|  ¡ D ]*\}}t | j| ¡ |rR| ¡ nd|¡ q0W q
W dS )zo
        Set the metadata. Update only the domains that are contained in the
        value dictionary.
        r   N)Úitemsr   r   Zset_ds_metadata_itemr
   )r   Úvaluer   r   Z	meta_nameZ
meta_valuer   r   r   r   >   s    
N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__Úpropertyr   Úsetterr   r   r   r   r      s   5r   N)Zdjango.contrib.gis.gdal.baser   Z"django.contrib.gis.gdal.prototypesr   r   r   r   r   r   r   Ú<module>   s   