In [ ]:
Copied!
# /// script
# requires-python = ">=3.12"
# dependencies = [
# "geopandas",
# "lonboard",
# "pyarrow",
# ]
# ///
# /// script
# requires-python = ">=3.12"
# dependencies = [
# "geopandas",
# "lonboard",
# "pyarrow",
# ]
# ///
ColumnLayer Example¶
This is a quick example notebook to show how to use the ColumnLayer
.
This is derived from @cboettig
's example in this issue.
Imports¶
In [ ]:
Copied!
import geopandas as gpd
from lonboard import ColumnLayer, Map
import geopandas as gpd
from lonboard import ColumnLayer, Map
In [ ]:
Copied!
DATA_URL = "https://data.source.coop/cboettig/conservation-policy/Inflation_Reduction_Act_Projects.geojson"
DATA_URL = "https://data.source.coop/cboettig/conservation-policy/Inflation_Reduction_Act_Projects.geojson"
In [ ]:
Copied!
df = gpd.read_file(DATA_URL, use_arrow=True)
df = gpd.read_file(DATA_URL, use_arrow=True)
In [ ]:
Copied!
layer = ColumnLayer.from_geopandas(
df,
get_elevation=df["FUNDING_NUMERIC"],
get_fill_color=[255, 255, 0, 140],
elevation_scale=0.01,
radius=10000,
pickable=True,
auto_highlight=True,
)
layer = ColumnLayer.from_geopandas(
df,
get_elevation=df["FUNDING_NUMERIC"],
get_fill_color=[255, 255, 0, 140],
elevation_scale=0.01,
radius=10000,
pickable=True,
auto_highlight=True,
)
In [ ]:
Copied!
m = Map(
layer,
view_state={
"longitude": -100,
"latitude": 35,
"zoom": 4,
"pitch": 45,
"bearing": 0,
},
)
m
m = Map(
layer,
view_state={
"longitude": -100,
"latitude": 35,
"zoom": 4,
"pitch": 45,
"bearing": 0,
},
)
m
In [ ]:
Copied!