Skip to content

GeoArrowPointCloudLayer does not accept geoarrow encoded 3d points from geoparquet #145

@pinireisman

Description

@pinireisman

GeoArrowPointCloudLayer does not accept the geoarrow geometry column of 3d points while GeoArrowScatterPlotLayer handles same column well.

I am getting the error:
deck: initialization of GeoArrowPointCloudLayer({id: 'pointcloud-xyz'}): Points of a PointCloudLayer in the geometry column must be three-dimensional. Error: Points of a PointCloudLayer in the geometry column must be three-dimensional.

this is coming from an assert that checks:
assert( geometryColumn.type.listSize === 3, "Points of a PointCloudLayer in the geometry column must be three-dimensional.", ); (from point-cloud-layer.ts line 142)

Here is how I got this

I have created a GeoParquet file with the following:
import geopandas as gpd
geometry = gpd.points_from_xy(x=df['X'], y=df['Y'], z=df['Z'])
gdf = gpd.GeoDataFrame(df[['point_id']], geometry=geometry, crs="EPSG:4326")
gdf.to_parquet('my_parquet', geometry_encoding='geoarrow')

I then read it into my frontend such:
const response = await fetch(url_to_my_parquet);
const buffer = await response.arrayBuffer();
const pointCloudData = await readParquet(new Uint8Array(buffer), { batchSize: Math.pow(2, 31) });
const table = arrow.tableFromIPC(pointCloudData.intoIPCStream());
const geometryColumn = table.getChild("geometry");
let gps_ref = [40, 40, 0];
...
layer = new GeoArrowPointCloudLayer({
id: "pointcloud-xyz",
data: table,
getPosition: geometryColumn,
getColor: fillColorAccessor,
pointSize: 2,
coordinateSystem: COORDINATE_SYSTEM.METER_OFFSETS,
coordinateOrigin: gps_ref,
});

I have verified that when reading the geometryColumn I get 3 columns named 'x','y','z'
(using the code: console.log('Geometry column fields:', geometryColumn.type.children.map(f => f.name)))

and when I try to use a GeoArrowScatterPlotLayer with the same data it works:

layer = new GeoArrowScatterplotLayer({
id: "scatterplot",
data: table,
getPosition: geometryColumn,
getFillColor: [255,0,0,180],
radiusMinPixels: 1,
getRadius: 0.05,
coordinateSystem: COORDINATE_SYSTEM.METER_OFFSETS,
coordinateOrigin: gps_ref,
});

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions