# !pip install leafmap import os import leafmap.heremap as leafmap # Read api_key from environment api_key = os.environ["HEREMAPS_API_KEY"] m = leafmap.Map(api_key=api_key) m m = leafmap.Map(api_key=api_key, center=[50, 19], zoom=4) # center=[lat, lon] m m = leafmap.Map(api_key=api_key, fullscreen_control=False) m m = leafmap.Map(api_key=api_key, height="450px") m m = leafmap.Map(api_key=api_key, basemap="HERE_RASTER_TERRAIN_MAP") m m.zoom_to_bounds((-9.0882278, -55.3228175, 168.2249543, 72.2460938)) # m.add_basemap(basemap="Esri.WorldTopoMap") m = leafmap.Map(api_key=api_key, layers_control=True) m.add_tile_layer( url="https://mt1.google.com/vt/lyrs=y&x={x}&y={y}&z={z}", name="Google Satellite", attribution="Google", ) m m = leafmap.Map(api_key=api_key, center=[0, 0], zoom=2, layers_control=True) in_geojson = "https://raw.githubusercontent.com/opengeos/leafmap/master/examples/data/cable_geo.geojson" m.add_geojson(in_geojson, layer_name="Cable lines") m import json m = leafmap.Map(api_key=api_key, center=[0, 0], zoom=2) with open("../data/countries.geojson") as fh: geo = json.load(fh) m.add_geojson(geo, layer_name="Countries") m m = leafmap.Map(api_key=api_key, center=[0, 0], zoom=2) url = "https://raw.githubusercontent.com/opengeos/leafmap/master/examples/data/countries.geojson" style = { "fillColor": "rgba(0, 0, 255, 0.2)", "strokeColor": "blue", } hover_style = {"fillColor": "rgba(0, 0, 255, 0.7)"} m.add_geojson(url, layer_name="Countries", style=style, hover_style=hover_style) m in_shp = "../data/countries.shp" in_geojson = "../data/us_states.json" in_kml = "../data/us_states.kml" m = leafmap.Map(api_key=api_key, center=[0, 0], zoom=2) m.add_shp(in_shp, layer_name="Shapefile") m m = leafmap.Map(api_key=api_key, center=[40.273502, -86.126976], zoom=4) m.add_kml(in_kml, layer_name="KML") m m = leafmap.Map(api_key=api_key, center=[0, 0], zoom=2) url = "https://raw.githubusercontent.com/opengeos/leafmap/master/examples/data/countries.geojson" m.add_vector(url, layer_name="Countries") m m = leafmap.Map(api_key=api_key, center=[0, 0], zoom=2) url = "http://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/2.5_month.geojson" point_style = { "strokeColor": "white", "lineWidth": 1, "fillColor": "red", "fillOpacity": 0.7, "radius": 5, } m.add_geojson(url, layer_name="Countries", point_style=point_style, default_popup=True) m import geopandas import json import os countries = geopandas.read_file(geopandas.datasets.get_path("naturalearth_cities")) point_style = { "strokeColor": "white", "lineWidth": 1, "fillColor": "blue", "fillOpacity": 0.7, "radius": 5, } m = leafmap.Map(api_key=api_key, center=[0, 0], zoom=3) m.add_gdf(countries, zoom_to_layer=False, point_style=point_style, default_popup=True) m