-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmap.py
More file actions
70 lines (55 loc) · 2.21 KB
/
map.py
File metadata and controls
70 lines (55 loc) · 2.21 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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#takes city name , makes a raw map according to the geocode.
import folium
def make_map(L,city):
# L -> location coordinate list
#creates the map according to geocode and returns the location where map is saved
my_map1 = folium.Map(location=L, zoom_start=12)
# Add the satellite tile layer
tile = folium.TileLayer(
tiles='https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}',
attr='Esri',
name='Esri Satellite',
overlay=False,
control=True
).add_to(my_map1)
# Add a WMS layer for land cover data (example: Copernicus Global Land Cover)
folium.raster_layers.WmsTileLayer(
url='https://services.terrascope.be/wms/v2',
name='Land Cover',
layers='WORLDCOVER_2020_MAP',
attr='Copernicus Global Land Service',
fmt='image/png',
transparent=True,
overlay=True,
control=True
).add_to(my_map1)
# Save the map to an HTML file
my_map1.save(f"seg_map/{city}.html")
return f"seg_map/{city}.html"
def make_map_satellite(L,city):
my_map1 = folium.Map(location=L, zoom_start=12)
tile = folium.TileLayer(
tiles = 'https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}',
attr = 'Esri',
name = 'Esri Satellite',
overlay = False,
control = True
).add_to(my_map1)
my_map1.save(f"seg_map/satellite/{city}.html")
return f"seg_map/satellite/{city}.html"
# def land_zoom(L,city,id):
# my_map1 = folium.Map(location=L, zoom_start=18)
# tile = folium.TileLayer(
# tiles = 'https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}',
# attr = 'Esri',
# name = 'Esri Satellite',
# overlay = False,
# control = True
# ).add_to(my_map1)
# folium.Marker(
# location=L,
# popup="Store",
# icon=folium.Icon(icon="store", prefix='fa')
# ).add_to(my_map1)
# my_map1.save(f"land_zoom/H/{city}_{id}.html")
# return f"land_zoom/H/{city}_{id}.html"