MCPcopy
hub / github.com/django/django / __init__

Method __init__

django/contrib/gis/gdal/layer.py:27–40  ·  view source on GitHub ↗

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.

(self, layer_ptr, ds)

Source from the content-addressed store, hash-verified

25 """
26
27 def __init__(self, layer_ptr, ds):
28 """
29 Initialize on an OGR C pointer to the Layer and the `DataSource` object
30 that owns this layer. The `DataSource` object is required so that a
31 reference to it is kept with this Layer. This prevents garbage
32 collection of the `DataSource` while this Layer is still active.
33 """
34 if not layer_ptr:
35 raise GDALException("Cannot create Layer, invalid pointer given")
36 self.ptr = layer_ptr
37 self._ds = ds
38 self._ldefn = capi.get_layer_defn(self._ptr)
39 # Does the Layer support random reading?
40 self._random_read = self.test_capability(b"RandomRead")
41
42 def __getitem__(self, index):
43 "Get the Feature at the specified index."

Callers

nothing calls this directly

Calls 2

test_capabilityMethod · 0.95
GDALExceptionClass · 0.90

Tested by

no test coverage detected