o
    lf                     @   sx   d dl Z d dlmZ d dlmZ d dlmZ d dlmZ zd dl	Z	W n e
y-   dZ	Y nw dd Zd	d
 Zdd ZdS )    N)BytesIO)settings)HttpResponse)loaderFc                 C   s\   t  }t|dtj}|d| tj W d   n1 s w   Y  |d |	 S )z0Return compressed KMZ from the given KML string.azdoc.kmlNr   )
r   zipfileZipFileZIP_DEFLATEDwritestrencoder   DEFAULT_CHARSETseekread)kmlkmzzf r   `/var/www/ticemtrilhas/avaliacao_env/lib/python3.10/site-packages/django/contrib/gis/shortcuts.pycompress_kml   s   
r   c                  O   s   t tj| i |ddS )z9Render the response as KML (using the correct MIME type).z$application/vnd.google-earth.kml+xmlcontent_type)r   r   render_to_stringargskwargsr   r   r   render_to_kml   s   r   c                  O   s   t ttj| i |ddS )zW
    Compress the KML content and return as KMZ (using the correct
    MIME type).
    z application/vnd.google-earth.kmzr   )r   r   r   r   r   r   r   r   render_to_kmz    s   r   )r   ior   django.confr   django.httpr   django.templater   numpyImportErrorr   r   r   r   r   r   r   <module>   s    	