Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Point cloud example #104

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 14 additions & 10 deletions examples/point/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@ import React, { useState, useEffect } from "react";
import { createRoot } from "react-dom/client";
import { StaticMap, MapContext, NavigationControl } from "react-map-gl";
import DeckGL, { Layer, PickingInfo } from "deck.gl/typed";
import { GeoArrowScatterplotLayer } from "@geoarrow/deck.gl-layers";
import {
GeoArrowScatterplotLayer,
GeoArrowPointCloudLayer,
} from "@geoarrow/deck.gl-layers";
import * as arrow from "apache-arrow";

const GEOARROW_POINT_DATA =
Expand Down Expand Up @@ -51,19 +54,20 @@ function Root() {

table &&
layers.push(
new GeoArrowScatterplotLayer({
new GeoArrowPointCloudLayer({
id: "geoarrow-points",
data: table,
// Pre-computed colors in the original table
getFillColor: table.getChild("colors")!,
getColor: table.getChild("colors")!,
getNormal: [0, 0, 1],
opacity: 0.01,
getRadius: ({ index, data }) => {
const recordBatch = data.data;
const row = recordBatch.get(index)!;
return row["avg_d_kbps"] / 10;
},
radiusMinPixels: 0.1,
pickable: true,
// getRadius: ({ index, data }) => {
// const recordBatch = data.data;
// const row = recordBatch.get(index)!;
// return row["avg_d_kbps"] / 10;
// },
// radiusMinPixels: 0.1,
// pickable: true,
}),
);

Expand Down
1 change: 1 addition & 0 deletions examples/point/generate_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ def main():

df = pd.read_parquet(path)
centroids = shapely.centroid(shapely.from_wkt(df["tile"]))
centroids = shapely.points(shapely.get_x(centroids), shapely.get_y(centroids), 0)

# Save space by using a smaller data type
df_cols = ["avg_d_kbps", "avg_u_kbps", "avg_lat_ms"]
Expand Down
2 changes: 2 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ export { GeoArrowColumnLayer } from "./column-layer.js";
export { GeoArrowH3HexagonLayer as _GeoArrowH3HexagonLayer } from "./h3-hexagon-layer.js";
export { GeoArrowHeatmapLayer } from "./heatmap-layer.js";
export { GeoArrowPathLayer } from "./path-layer.js";
export { GeoArrowPointCloudLayer } from "./point-cloud-layer.js";
export { GeoArrowPolygonLayer } from "./polygon-layer.js";
export { GeoArrowScatterplotLayer } from "./scatterplot-layer.js";
export { GeoArrowSolidPolygonLayer } from "./solid-polygon-layer.js";
Expand All @@ -14,6 +15,7 @@ export type { GeoArrowColumnLayerProps } from "./column-layer.js";
export type { GeoArrowH3HexagonLayerProps as _GeoArrowH3HexagonLayerProps } from "./h3-hexagon-layer.js";
export type { GeoArrowHeatmapLayerProps } from "./heatmap-layer.js";
export type { GeoArrowPathLayerProps } from "./path-layer.js";
export type { GeoArrowPointCloudLayerProps } from "./point-cloud-layer.js";
export type { GeoArrowPolygonLayerProps } from "./polygon-layer.js";
export type { GeoArrowScatterplotLayerProps } from "./scatterplot-layer.js";
export type { GeoArrowSolidPolygonLayerProps } from "./solid-polygon-layer.js";
Expand Down
Loading