Geohash Layer Example¶
Geohash spatial indexing visualization using deck.gl GeohashLayer.
In [ ]:
Copied!
# %pip install anymap-ts
# %pip install anymap-ts
In [ ]:
Copied!
from anymap_ts import DeckGLMap
from anymap_ts import DeckGLMap
Define geohash data¶
In [ ]:
Copied!
# Sample geohash data (around San Francisco area, precision 5)
geohash_data = [
{"geohash": "9q8yy", "value": 150},
{"geohash": "9q8yz", "value": 200},
{"geohash": "9q8yv", "value": 180},
{"geohash": "9q8yw", "value": 250},
{"geohash": "9q8yx", "value": 300},
{"geohash": "9q8yu", "value": 220},
{"geohash": "9q8yt", "value": 190},
{"geohash": "9q8ys", "value": 280},
{"geohash": "9q8yr", "value": 170},
{"geohash": "9q8yq", "value": 230},
]
# Sample geohash data (around San Francisco area, precision 5)
geohash_data = [
{"geohash": "9q8yy", "value": 150},
{"geohash": "9q8yz", "value": 200},
{"geohash": "9q8yv", "value": 180},
{"geohash": "9q8yw", "value": 250},
{"geohash": "9q8yx", "value": 300},
{"geohash": "9q8yu", "value": 220},
{"geohash": "9q8yt", "value": 190},
{"geohash": "9q8ys", "value": 280},
{"geohash": "9q8yr", "value": 170},
{"geohash": "9q8yq", "value": 230},
]
Create map with geohash layer¶
In [ ]:
Copied!
m = DeckGLMap(center=[-122.4, 37.75], zoom=10, pitch=45)
m.add_basemap("CartoDB.DarkMatter")
m.add_geohash_layer(
data=geohash_data,
get_geohash="geohash",
get_fill_color=[100, 200, 100, 180],
get_elevation="value",
extruded=True,
elevation_scale=100,
pickable=True,
)
m
m = DeckGLMap(center=[-122.4, 37.75], zoom=10, pitch=45)
m.add_basemap("CartoDB.DarkMatter")
m.add_geohash_layer(
data=geohash_data,
get_geohash="geohash",
get_fill_color=[100, 200, 100, 180],
get_elevation="value",
extruded=True,
elevation_scale=100,
pickable=True,
)
m
Export to HTML¶
In [ ]:
Copied!
m.to_html("geohash_layer_example.html")
m.to_html("geohash_layer_example.html")