
v^-                 @   s:   d  d l  m Z d  d l m Z Gd 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/  d g } t  j |  j  } | re d } | | } x1 | rd | j | j    | d 7} | | } q4 Wt  j |  i  } x | D] } t  j |  j | d k r d n	 | j    } | s q i  } d } | | } xC | r| j   j d  \ }	 }
 |
 | |	 <| d 7} | | } q W| | | p&d <q W| 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.
        DEFAULTr      N=)	capiZget_ds_metadata_domain_list_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   E/tmp/pip-build-8lau8j11/django/django/contrib/gis/gdal/raster/base.pymetadata	   s6    		
	
!
	

zGDALRasterBase.metadatac             C   s   x | j    D]x \ } } | d k r+ d n	 | j   } xK | j    D]= \ } } t j |  j | j   | rw | j   n d |  qD Wq Wd 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   2r   N)Zdjango.contrib.gis.gdal.baser   Z"django.contrib.gis.gdal.prototypesr   r   r   r   r   r   r   <module>   s   