84 openstreetmap
Downloading OpenStreetMap data with a single line of code
Uncomment the following line to install geemap if needed.
# !pip install geopandas osmnx geemap
import geemap.foliumap as geemap
Add OSM data of place(s) by name or ID to the map. Note that the geemap custom layer control does not support GeoJSON, we need to use the ipyleaflet built-in layer control.
m = geemap.Map(toolbar_control=False, layers_control=True)
m.add_osm_from_geocode("New York City", layer_name="NYC")
m
m = geemap.Map(toolbar_control=False, layers_control=True)
m.add_osm_from_geocode("Chicago, Illinois", layer_name="Chicago, IL")
m
Add OSM entities within boundaries of geocodable place(s) to the map.
m = geemap.Map(toolbar_control=False, layers_control=True)
place = "Bunker Hill, Los Angeles, California"
tags = {"building": True}
m.add_osm_from_place(place, tags, layer_name="Los Angeles, CA")
m
Show OSM feature tags.
# geemap.osm_tags_list()
Add OSM entities within some distance N, S, E, W of address to the map.
m = geemap.Map(toolbar_control=False, layers_control=True)
m.add_osm_from_address(
address="New York City", tags={"amenity": "bar"}, dist=1500, layer_name="NYC bars"
)
m
m = geemap.Map(toolbar_control=False, layers_control=True)
m.add_osm_from_address(
address="New York City",
tags={"landuse": ["retail", "commercial"], "building": True},
dist=1000,
layer_name="NYC buildings",
)
m
Add OSM entities within a N, S, E, W bounding box to the map.
m = geemap.Map(toolbar_control=False, layers_control=True)
north, south, east, west = 40.7551, 40.7454, -73.9738, -73.9965
m.add_osm_from_bbox(
north, south, east, west, tags={"amenity": "bar"}, layer_name="NYC bars"
)
m
Add OSM entities within some distance N, S, E, W of a point to the map.
m = geemap.Map(
center=[46.7808, -96.0156], zoom=12, toolbar_control=False, layers_control=True
)
m.add_osm_from_point(
center_point=(46.7808, -96.0156),
tags={"natural": "water"},
dist=10000,
layer_name="Lakes",
)
m
m = geemap.Map(
center=[39.9170, 116.3908], zoom=15, toolbar_control=False, layers_control=True
)
m.add_osm_from_point(
center_point=(39.9170, 116.3908),
tags={"building": True, "natural": "water"},
dist=1000,
layer_name="Beijing",
)
m
Add OSM entities within the current map view to the map.
m = geemap.Map(toolbar_control=False, layers_control=True)
m.set_center(-73.9854, 40.7500, 16)
m
The add_osm_from_view()
is only available for the ipyleaflet plotting backend.
# m.add_osm_from_view(tags={"amenity": "bar", "building": True}, layer_name="New York")
Create a GeoPandas GeoDataFrame from place.
gdf = geemap.osm_gdf_from_place("New York City", tags={"amenity": "bar"})
gdf