Vertdure commited on
Commit
fa4ff30
1 Parent(s): 331c3ea

Update pages/12_🌲_VertXtractor.py

Browse files
Files changed (1) hide show
  1. pages/12_🌲_VertXtractor.py +9 -19
pages/12_🌲_VertXtractor.py CHANGED
@@ -9,7 +9,6 @@ import json
9
 
10
  st.set_page_config(layout="wide", page_title="Extracteur de données géospatiales")
11
 
12
- # Dictionnaires d'ESRI_extractor
13
  ESRI_SERVICES = {
14
  'World_Imagery' : 'https://services.arcgisonline.com/arcgis/rest/services/World_Imagery/MapServer',
15
  'World_Topo_Map' : 'https://services.arcgisonline.com/arcgis/rest/services/World_Topo_Map/MapServer',
@@ -88,35 +87,26 @@ def get_esri_image_url(bbox, service_url):
88
  'bbox': f'{bbox[0]},{bbox[1]},{bbox[2]},{bbox[3]}',
89
  'bboxSR': 4326,
90
  'size': '1000,1000',
91
- 'imageSR': 3857,
92
- 'format': ESRI_FORMATS['png'],
93
- 'f': 'json'
 
94
  }
95
- response = requests.get(f"{service_url}/export", params=params)
96
- if response.status_code == 200:
97
- result = response.json()
98
- if 'href' in result:
99
- return result['href']
100
- return None
101
 
102
  def get_esri_terrain_url(bbox, service_url):
103
  params = {
104
  'bbox': f'{bbox[0]},{bbox[1]},{bbox[2]},{bbox[3]}',
105
  'bboxSR': 4326,
106
  'size': '1000,1000',
107
- 'imageSR': 3857,
108
- 'format': ESRI_FORMATS['tiff'],
109
  'pixelType': 'F32',
110
  'noDataInterpretation': 'esriNoDataMatchAny',
111
  'interpolation': '+RSP_BilinearInterpolation',
112
- 'f': 'json'
113
  }
114
- response = requests.get(f"{service_url}/exportImage", params=params)
115
- if response.status_code == 200:
116
- result = response.json()
117
- if 'href' in result:
118
- return result['href']
119
- return None
120
 
121
  def main():
122
  st.title("Extracteur de données Swisstopo et ESRI")
 
9
 
10
  st.set_page_config(layout="wide", page_title="Extracteur de données géospatiales")
11
 
 
12
  ESRI_SERVICES = {
13
  'World_Imagery' : 'https://services.arcgisonline.com/arcgis/rest/services/World_Imagery/MapServer',
14
  'World_Topo_Map' : 'https://services.arcgisonline.com/arcgis/rest/services/World_Topo_Map/MapServer',
 
87
  'bbox': f'{bbox[0]},{bbox[1]},{bbox[2]},{bbox[3]}',
88
  'bboxSR': 4326,
89
  'size': '1000,1000',
90
+ 'imageSR': 4326,
91
+ 'format': 'png',
92
+ 'f': 'html',
93
+ 'transparent': 'true'
94
  }
95
+ return f"{service_url}/export?{'&'.join([f'{k}={v}' for k, v in params.items()])}"
 
 
 
 
 
96
 
97
  def get_esri_terrain_url(bbox, service_url):
98
  params = {
99
  'bbox': f'{bbox[0]},{bbox[1]},{bbox[2]},{bbox[3]}',
100
  'bboxSR': 4326,
101
  'size': '1000,1000',
102
+ 'imageSR': 4326,
103
+ 'format': 'tiff',
104
  'pixelType': 'F32',
105
  'noDataInterpretation': 'esriNoDataMatchAny',
106
  'interpolation': '+RSP_BilinearInterpolation',
107
+ 'f': 'image'
108
  }
109
+ return f"{service_url}/exportImage?{'&'.join([f'{k}={v}' for k, v in params.items()])}"
 
 
 
 
 
110
 
111
  def main():
112
  st.title("Extracteur de données Swisstopo et ESRI")