Feature Data
In this section, we revisit the data/point.geojson dataset.
ArchGDAL.registerdrivers() do
ArchGDAL.read(filepath) do dataset
print(dataset)
end
endFeature Layers
ArchGDAL.registerdrivers() do
ArchGDAL.read(filepath) do dataset
layer = ArchGDAL.getlayer(dataset, 0)
print(layer)
end
endThe 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.getlayerdefn(layer): the schema of the layer featuresArchGDAL.nfield(featuredefn): the number of fieldsArchGDAL.ngeomfield(featuredefn): the number of geometriesfielddefn = ArchGDAL.getfielddefn(featuredefn, i): the definition for fieldigeomfielddefn = ArchGDAL.getgeomfielddefn(featuredefn, i): the definition for geometryi
Field Definitions
Each fielddefn defines an attribute of a feature, and supports the following:
ArchGDAL.getname(fielddefn): the name of the field (FIDorpointname)ArchGDAL.gettype(fielddefn): the type of the field (OFTRealorOFTString)
Each geomfielddefn defines an attribute of a geometry, and supports the following:
ArchGDAL.getgeomname(geomfielddefn): the name of the geometry (empty in this case)ArchGDAL.gettype(geomfielddefn): the type of the geometry (wkbPoint)
Individual Features
We can examine an individual feature
ArchGDAL.registerdrivers() do
ArchGDAL.read(filepath) do dataset
layer = ArchGDAL.getlayer(dataset, 0)
ArchGDAL.getfeature(layer, 2) do feature
print(feature)
end
end
endYou can programmatically retrieve the information using
ArchGDAL.nfield(feature): the number of fields (2)ArchGDAL.ngeomfield(feature): the number of geometries (1)ArchGDAL.getfield(feature, i): thei-th field (0.0and"a")ArchGDAL.getgeomfield(feature, i): thei-th geometry (the WKT displayPOINT)
More information on geometries can be found in Geometric Operations.