Tabular Interface
ArchGDAL now brings in greater flexibilty in terms of vector data handling via the Tables.jl API. In general, tables are modelled based on feature layers and support multiple geometries per layer. Namely, the layer(s) of a dataset can be converted to DataFrame(s) to perform miscellaneous spatial operations.
Here is a quick example based on the data/point.geojson
dataset:
dataset = ArchGDAL.read("data/point.geojson")
DataFrames.DataFrame(ArchGDAL.getlayer(dataset, 0))
4×3 DataFrame
Row | FID | pointname | |
---|---|---|---|
IGeometr… | Float64 | String | |
1 | Geometry: wkbPoint | 2.0 | point-a |
2 | Geometry: wkbPoint | 3.0 | point-b |
3 | Geometry: wkbPoint | 0.0 | a |
4 | Geometry: wkbPoint | 3.0 | b |
To illustrate multiple geometries, here is a second example based on the data/multi_geom.csv
dataset:
dataset1 = ArchGDAL.read("data/multi_geom.csv", options = ["GEOM_POSSIBLE_NAMES=point,linestring", "KEEP_GEOM_COLUMNS=NO"])
DataFrames.DataFrame(ArchGDAL.getlayer(dataset1, 0))
2×5 DataFrame
Row | point | linestring | id | zoom | location |
---|---|---|---|---|---|
IGeometr… | IGeometr… | String | String | String | |
1 | Geometry: wkbPoint | Geometry: wkbLineString | 5.1 | 1.0 | Mumbai |
2 | Geometry: wkbPoint | Geometry: wkbLineString | 5.2 | 2.0 | New Delhi |