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

[EPIC] Support for ColumnLayer (extruded point values) #543

Open
cboettig opened this issue Jun 12, 2024 · 3 comments
Open

[EPIC] Support for ColumnLayer (extruded point values) #543

cboettig opened this issue Jun 12, 2024 · 3 comments

Comments

@cboettig
Copy link

Context

I'd like to be able to use lonboard to create 3d mapping of data that include extruded column layers, like this (pure pydeck code below).

image

Issue

I'd like to be able to translate this pure-pydeck example into lonboard (i.e. as proof-of-principle for support for this layer).

import geopandas as gpd
import pydeck as pdk

DATA_URL = 'https://data.source.coop/cboettig/conservation-policy/Inflation_Reduction_Act_Projects.geojson'
df = gpd.read_file(DATA_URL)

column_layer = pdk.Layer(
    "ColumnLayer",
    data=df,
    get_position=["LONGITUDE", "LATITUDE"],
    get_elevation="FUNDING_NUMERIC",
    get_fill_color = [256,256,0, 140],
    elevation_scale=.01,
    radius=10000,
    pickable=True,
    auto_highlight=True,
)

INITIAL_VIEW_STATE = pdk.ViewState(latitude=35, longitude=-100, zoom=4, max_zoom=16, pitch=45, bearing=0)

r = pdk.Deck(
    column_layer,
    initial_view_state = INITIAL_VIEW_STATE,
    map_style=pdk.map_styles.CARTO_ROAD,
)
r

I think the key piece here is just adding support for "ColumnLayer", but not sure. Ideally I'd like to be able to layer this kind of rendering with other layers also generated in lonboard.

@kylebarron
Copy link
Member

Indeed, the primary functionality that needs to be added is support for ColumnLayer. It should be relatively straightforward.

Though on the JS side there's a question of whether to add this functionality to https://github.com/geoarrow/deck.gl-layers now that there's a semi-official fork in https://github.com/visgl/deck.gl-community that I haven't had time to engage with yet.

@kylebarron
Copy link
Member

Oh actually there's already a ColumnLayer in deck.gl-layers https://github.com/geoarrow/deck.gl-layers/blob/main/src/column-layer.ts. So we only need to touch the Lonboard side

@kylebarron
Copy link
Member

In case you have an interest in making a PR, adding the ColumnLayer should be very similar to adding the PolygonLayer, so you should be able to use that PR as guidance. #330

It turns out that we already have the column layer on the JS side

export class ColumnModel extends BaseArrowLayerModel {
so we only need to add the Python bits

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants