EOmaps v7.4
Closed Apr 2, 2024
0% complete
maybe:
- merge new icons #180
-
add info on how to use
OSMnx
together withEOmaps
to fetch OSM data
osmnx example:
import osmnx as ox
def fetch_data(osmnx_bbox):
coast = ox.features_from_bbox(*osmnx_bbox, tags={'natural': ['coastline']})
beach = ox.features_from_bbox(*osmnx_bbox, tags={'natural': ['beach']})
scrub = ox.features_from_bbox(*os…
maybe:
- merge new icons #180
- add info on how to use
OSMnx
together withEOmaps
to fetch OSM data
osmnx example:
import osmnx as ox
def fetch_data(osmnx_bbox):
coast = ox.features_from_bbox(*osmnx_bbox, tags={'natural': ['coastline']})
beach = ox.features_from_bbox(*osmnx_bbox, tags={'natural': ['beach']})
scrub = ox.features_from_bbox(*osmnx_bbox, tags={'natural': ['scrub']})
build = ox.features_from_bbox(*osmnx_bbox, tags={'building': True})
roads = ox.features_from_bbox(*osmnx_bbox, tags={'highway': True})
return coast, beach, scrub, build, roads
lon0, lon1, lat0, lat1 = (9.39708098432, 9.40989677317, 43.0028512847, 43.0093021058)
coast, beach, scrub, build, roads = fetch_data((lat0, lat1, lon0, lon1))
# %%
from eomaps import Maps
m = Maps(3857)
m.set_extent((lon0, lon1, lat0, lat1))
#m.add_wms.ESRI_ArcGIS.SERVICES.World_Imagery.add_layer.xyz_layer()
# add all features on individual layers
m.add_gdf(coast, fc="none", ec="orange", lw=2, layer="coastline")
m.add_gdf(beach, fc="beige", ec="olive", lw=0.5, hatch="xxxxx", layer="beach")
m.add_gdf(roads, fc="none", ec="k", lw=1, layer="roads")
m.add_gdf(scrub, fc="lawngreen", ec="darkgreen", lw=0.6, hatch="///", layer="scrub")
m.add_gdf(scrub, fc="none", ec="lawngreen", lw=2, layer="scrub_2")
m_build = m.new_layer("buildings")
m_build.add_gdf(build, fc="tomato", ec="r", lw=.25,
picker_name="buildings", pick_method="contains")
m_build.cb.pick["buildings"].attach.highlight_geometry(fc="r", ec="k")
m_build.cb.pick["buildings"].attach.annotate(text=lambda ID, **kwargs: str(ID))
# transparently overlay the layers to compose the final image
m.show_layer(("base", 1),
("scrub", 0.25),
("scrub_2", 1),
("roads", 1),
("beach", 0.5),
("buildings", 1),
("coastline", 1),
)
This milestone is closed.
No open issues remain. View closed issues or see open milestones in this repository.