File: //usr/lib/python3/dist-packages/django/contrib/gis/utils/__pycache__/ogrinfo.cpython-310.pyc
o
���_� � @ s* d Z ddlmZ ddlmZ ddd�ZdS ) z�
This module includes some utility functions for inspecting the layout
of a GDAL data source -- the functionality is analogous to the output
produced by the `ogrinfo` utility.
� )�
DataSource)�GEO_CLASSES�
c C s` t | t�r
t| �} n
t | t�rntd��t| �D ]�\}}td| j � td| � tdt|jj j
� tdt|� � td|j � |j
j}td|dd � |d d
� f � td| � ttt|j�� }d| }t|d
|� �D ];\}}td| � |jD ]-} || j}
|| |
f }|�| �}|r�t |t�r�d}
nd}
||
| 7 }n|d7 }t|� q~qqqd
S )z�
Walk the available layers in the supplied `data_source`, displaying
the fields for the first `num_features` features.
z>Data source parameter must be a string or a DataSource object.zdata source : %sz
==== layer %sz shape type: %sz # features: %sz srs: %sz extent: %s - %sr � � z%Displaying the first %s features ====z %%%ss: %%sNz=== Feature %sz ("%s")z (%s)z (None))�
isinstance�strr � Exception� enumerate�print�namer � geom_type�num�__name__�len�srs�extent�tuple�max�map�fields� type_name�get)�data_source�num_features�i�layer�
extent_tup�width�fmt�j�feature�fld_namer �output�val�val_fmt� r&