Feature Data
In this section, we revisit the data/point.geojson dataset.
dataset = ArchGDAL.read("data/point.geojson")GDAL Dataset (Driver: GeoJSON/GeoJSON) File(s): Number of feature layers: 1 Layer 0: point (wkbPoint)
Feature Layers
Retrieve a layer from a dataset using ArchGDAL.getlayer
layer = ArchGDAL.getlayer(dataset, 0)Layer: point
Geometry 0 (): [wkbPoint], POINT (100 0), POINT (100.2785 0.0893), ...
Field 0 (FID): [OFTReal], 2.0, 3.0, 0.0, 3.0
Field 1 (pointname): [OFTString], point-a, point-b, a, b
The display provides
- the name of the feature layer (
point) - the geometries in the dataset, and their brief summary.
- the fields in the dataset, and their brief summary.
You can also programmatically retrieve them using
ArchGDAL.getname(layer): the name of the feature layerArchGDAL.nfeature(layer): the number of features in the layerfeaturedefn =ArchGDAL.layerdefn(layer): the schema of the layer featuresArchGDAL.nfield(featuredefn): the number of fieldsArchGDAL.ngeom(featuredefn): the number of geometriesArchGDAL.getfielddefn(featuredefn, i): the definition for thei-th fieldArchGDAL.getgeomdefn(featuredefn, i): the definition for thei-th geometry
Field Definitions
Each fielddefn defines an attribute of a feature, and supports the following:
ArchGDAL.getname(fielddefn): the name of the field ("FID"or"pointname")ArchGDAL.gettype(fielddefn): the type of the field (OFTRealorOFTString)
Each geomdefn defines an attribute of a geometry, and supports the following:
ArchGDAL.getname(geomdefn): the name of the geometry (""in this case)ArchGDAL.gettype(geomdefn): the type of the geometry (wkbPoint)
Individual Features
We can examine an individual feature
ArchGDAL.getfeature(layer, 2) do feature
print(feature)
endFeature (index 0) geom => POINT (index 0) FID => 0.0 (index 1) pointname => a
You can programmatically retrieve the information using
ArchGDAL.nfield(feature): the number of fields (2)ArchGDAL.ngeom(feature): the number of geometries (1)ArchGDAL.getfield(feature, i): thei-th field (0.0and"a")ArchGDAL.getgeom(feature, i): thei-th geometry (the WKT displayPOINT)
More information on geometries can be found in Geometric Operations.