o
    i                     @   sT   d dl mZ d dlmZ d dlmZ d dlmZ d dl	m
Z
mZ G dd deZdS )	    )c_void_p)GDALBase)GDALException)ds)force_bytes	force_strc                
   @   s\   e Zd ZdZdddddddddd	Zdd Zd	d
 Zedd Zedd Z	e
dd ZdS )Driverz
    Wrap a GDAL/OGR Data Source Driver.
    For more information, see the C API documentation:
    https://gdal.org/api/vector_c_api.html
    https://gdal.org/api/raster_c_api.html
    zESRI ShapefileTIGERGTiffJPEG)	esrishpshapetigerz
tiger/linetifftifjpegjpgc                 C   s   t |tr$|   | | jv r| j|  }n|}ttt|}nt |t	r3|   t
|}nt |tr;|}ntdt| |sKtd| || _dS )zT
        Initialize an GDAL/OGR driver on either a string or integer input.
        z/Unrecognized input type for GDAL/OGR Driver: %sz1Could not initialize GDAL/OGR Driver on input: %sN)
isinstancestrensure_registeredlower_aliasr   capiget_driver_by_namer   int
get_driverr   typeptr)selfdr_inputnamedriver r#   ^/var/www/html/formularioweb/env/lib/python3.10/site-packages/django/contrib/gis/gdal/driver.py__init__#   s&   




zDriver.__init__c                 C   s   | j S )N)r!   r   r#   r#   r$   __str__E   s   zDriver.__str__c                 C   s   t  s
t   dS dS )zB
        Attempt to register all the data source drivers.
        N)r   get_driver_countregister_allclsr#   r#   r$   r   H   s   zDriver.ensure_registeredc                 C   s   t  S )zO
        Return the number of GDAL/OGR data source drivers registered.
        )r   r(   r*   r#   r#   r$   driver_countR   s   zDriver.driver_countc                 C   s   t t| jS )zA
        Return description/name string for this driver.
        )r   r   get_driver_descriptionr   r&   r#   r#   r$   r!   Y   s   zDriver.nameN)__name__
__module____qualname____doc__r   r%   r'   classmethodr   r,   propertyr!   r#   r#   r#   r$   r   	   s(    "
	
r   N)ctypesr   django.contrib.gis.gdal.baser   django.contrib.gis.gdal.errorr   "django.contrib.gis.gdal.prototypesr   r   django.utils.encodingr   r   r   r#   r#   r#   r$   <module>   s    