-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmap.py
More file actions
31 lines (24 loc) · 1.16 KB
/
Copy pathmap.py
File metadata and controls
31 lines (24 loc) · 1.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import osmnx as ox
import matplotlib.pyplot as plt
# Definice oblasti (střední Evropa)
north, south, east, west = 55, 45, 20, 5
# Načtení vrstev z OpenStreetMap
boundary = ox.geometries_from_bbox(north, south, east, west, tags={'boundary': 'administrative'})
water = ox.geometries_from_bbox(north, south, east, west, tags={'natural': 'water'})
forest = ox.geometries_from_bbox(north, south, east, west, tags={'landuse': 'forest'})
roads = ox.graph_from_bbox(north, south, east, west, network_type='all')
cities = ox.geometries_from_bbox(north, south, east, west, tags={'place': 'city'})
# Vytvoření GeoDataFrame pro silnice
roads_gdf = ox.graph_to_gdfs(roads, nodes=False)
# Vykreslení mapy
fig, ax = plt.subplots(figsize=(10, 10))
boundary.plot(ax=ax, color='black', linewidth=0.5, label='Boundary')
water.plot(ax=ax, color='blue', label='Water')
forest.plot(ax=ax, color='green', label='Forest')
roads_gdf.plot(ax=ax, color='gray', linewidth=0.5, label='Roads')
cities.plot(ax=ax, color='red', markersize=10, label='Cities')
# Uložit mapu do SVG
svg_file_path = "central_europe_map.svg"
plt.savefig(svg_file_path, format='svg')
# Display file path for download
svg_file_path