Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
giswqs
GitHub Repository: giswqs/geemap
Path: blob/master/docs/notebooks/107_pydeck.ipynb
2313 views
Kernel: Python 3

image

Uncomment the following line to install geemap if needed.

# !pip install -U geemap
import ee import geemap.deck as geemap

Create an interactive map.

m = geemap.Map(center=(40, -100), zoom=3) m

Add basemap.

m = geemap.Map() m.add_basemap("HYBRID") m

Add vector data to the map. It supports any GeoPandas supported format, such as GeoJSON, shapefile, KML.

m = geemap.Map() filename = ( "https://github.com/giswqs/streamlit-geospatial/raw/master/data/us_states.geojson" ) m.add_vector(filename, random_color_column="STATEFP") m

Add a GeoPandas GeoDataFrame to the map.

import geopandas as gpd
url = ( "https://github.com/giswqs/streamlit-geospatial/raw/master/data/us_counties.geojson" ) gdf = gpd.read_file(url)
m = geemap.Map() m.add_gdf(gdf, random_color_column="STATEFP") m

Create a 3D view of the map. Press Ctrl and hold down the left mouse button to rotate the 3D view.

initial_view_state = { "latitude": 40, "longitude": -100, "zoom": 3, "pitch": 45, "bearing": 10, } m = geemap.Map(initial_view_state=initial_view_state) filename = ( "https://github.com/giswqs/streamlit-geospatial/raw/master/data/us_states.geojson" ) m.add_vector( filename, random_color_column="STATEFP", extruded=True, get_elevation="ALAND", elevation_scale=0.000001, ) m

Add Earth Engine layers.

Map = geemap.Map(center=(40, -100), zoom=3) dem = ee.Image("USGS/SRTMGL1_003") vis_params = { "min": 0, "max": 4000, "palette": ["006633", "E5FFCC", "662A00", "D8D8D8", "F5F5F5"], } Map.addLayer(dem, vis_params, "SRTM DEM") Map