-
Notifications
You must be signed in to change notification settings - Fork 4
Open
Description
In #59 we implement the geometry and collection union types in the latest version of the GeoArrow spec; however the geometry and geometry collection type doesn't quite match geoarrow-rs' because our union members are named (which I think is in the spec?). When we figure out what the right version is, we should test it!
# pip install --pre --upgrade geoarrow-rust-core
from geoarrow.rust.core._rust import NativeType
import geoarrow.pyarrow as ga
import pyarrow as pa
import geoarrow.types as gt
rs_type = NativeType(type="geometrycollection", dimension="XY", coord_type="separated")
pa_type = pa.DataType._import_from_c_capsule(rs_type.__arrow_c_schema__())
ga_type = gt.type_spec(
gt.Encoding.GEOARROW, gt.GeometryType.GEOMETRYCOLLECTION, gt.Dimensions.XY
).to_pyarrow()
pa_type.storage_type
#> ListType(list<geometries: dense_union<: struct<x: double not null, y: double not null>=1, : list<vertices: struct<x: double not null, y: double not null> not null>=2, : list<rings: list<vertices: struct<x: double not null, y: double not null> not null> not null>=3, : list<points: struct<x: double not null, y: double not null> not null>=4, : list<linestrings: list<vertices: struct<x: double not null, y: double not null> not null> not null>=5, : list<polygons: list<rings: list<vertices: struct<x: double not null, y: double not null> not null> not null> not null>=6> not null>)
ga_type.storage_type
#> ListType(list<geometries: dense_union<Point: struct<x: double not null, y: double not null>=1, LineString: list<vertices: struct<x: double not null, y: double not null> not null>=2, Polygon: list<vertices: list<rings: struct<x: double not null, y: double not null> not null> not null>=3, MultiPoint: list<points: struct<x: double not null, y: double not null> not null>=4, MultiLineString: list<vertices: list<linestrings: struct<x: double not null, y: double not null> not null> not null>=5, MultiPolygon: list<vertices: list<rings: list<polygons: struct<x: double not null, y: double not null> not null> not null> not null>=6> not null>)
Metadata
Metadata
Assignees
Labels
No labels