Server : Apache System : Linux iad1-shared-b8-43 6.6.49-grsec-jammy+ #10 SMP Thu Sep 12 23:23:08 UTC 2024 x86_64 User : dh_edsupp ( 6597262) PHP Version : 8.2.26 Disable Function : NONE Directory : /lib/python3/dist-packages/django/contrib/gis/gdal/__pycache__/ |
Upload File : |
o �aP! � @ s� d dl mZmZ d dlmZ d dlmZmZ d dlm Z m Z d dlmZ d dl mZ d dlmZ d dlmZ d d lmZmZmZ d d lmZ d dlmZmZ G dd � d e�ZdS )� )�byref�c_double)�GDALBase)�Envelope�OGREnvelope)� GDALException�SRSException)�Feature)� OGRFieldTypes)�OGRGeometry)�OGRGeomType)�ds�geom�srs)�SpatialReference)�force_bytes� force_strc @ s� e Zd ZdZdd� Zdd� Zdd� Zdd � Zd d� Zdd � Z e dd� �Ze dd� �Ze d/dd��Z e dd� �Ze dd� �Ze dd� �Ze dd� �Ze dd� �Ze dd � �Ze d!d"� �Zd#d$� Zd%d&� Ze ee�Zd'd(� Zd0d*d+�Zd,d-� Zd.S )1�LayerzSA class that wraps an OGR Layer, needs to be instantiated from a DataSource object.c C s6 |st d��|| _|| _t�| j�| _| �d�| _dS )a7 Initialize on an OGR C pointer to the Layer and the `DataSource` object that owns this layer. The `DataSource` object is required so that a reference to it is kept with this Layer. This prevents garbage collection of the `DataSource` while this Layer is still active. z*Cannot create Layer, invalid pointer givens RandomReadN) r �ptr�_ds�capi�get_layer_defn�_ptr�_ldefn�test_capability�_random_read)�self� layer_ptrr � r �?/usr/lib/python3/dist-packages/django/contrib/gis/gdal/layer.py�__init__ s zLayer.__init__c sb t |t�r|dk r td��� �|�S t |t�r-|�� j�\}}}� fdd�t|||�D �S td��)z'Get the Feature at the specified index.r z/Negative indices are not allowed on OGR Layers.c s g | ]}� � |��qS r )� _make_feature)�.0�fid�r r r � <listcomp>3 � z%Layer.__getitem__.<locals>.<listcomp>z>Integers and slices may only be used when indexing OGR Layers.) � isinstance�int� IndexErrorr! �slice�indices�num_feat�range� TypeError)r �index�start�stop�strider r$ r �__getitem__'