-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
117 lines (108 loc) · 4.23 KB
/
index.html
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
<html>
<head>
<meta charset="utf-8" />
<meta
name="viewport"
content="initial-scale=1,maximum-scale=1,user-scalable=no"
/>
<title>Visor Geocodificador ICGC - exemple ESRI</title>
<style>
html,
body,
#viewDiv {
padding: 0;
margin: 0;
height: 100%;
width: 100%;
}
</style>
<link
rel="stylesheet"
href="https://js.arcgis.com/4.14/esri/themes/light/main.css"
/>
<script type="text/javascript" src="js/capes.js"></script>
<script type="text/javascript" src="js/cercadorPelias.js"></script>
</head>
<body>
<div id="viewDiv"></div>
<script src="https://js.arcgis.com/4.14/"></script>
<script>
require([
"esri/Graphic", //Per funcions relacionades amb cercador
"esri/request", //Per funcions relacionades amb cercador
"esri/views/MapView",
"esri/widgets/Search", //Per funcions relacionades amb cercador
"esri/widgets/Search/SearchSource", //Per funcions relacionades amb cercador
"esri/geometry/geometryEngine", //Per funcions relacionades amb cercador
"esri/geometry/Point", //Per funcions relacionades amb cercador
"esri/WebMap",
"esri/layers/Layer",
"esri/layers/MapImageLayer",
"esri/portal/Portal",
"esri/widgets/BasemapToggle"
], function(
Graphic,
esriRequest,
MapView,
Search,
SearchSource,
geometryEngine,
Point,
WebMap,
Layer,
MapImageLayer,
Portal,
BasemapToggle
) {
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
// PART CAPES
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
var{map,view,toggle} = construirCapes(MapView,WebMap,Layer,MapImageLayer,Portal,BasemapToggle);
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
// PART DEL CERCADOR
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Create Search widget using custom SearchSource
var searchWidget = new Search({
view: view,
//Geocodificador PELIAS per Topònims
sources: [customSearchSource(Graphic,esriRequest,MapView,Search,SearchSource,geometryEngine,Point)],
includeDefaultSources: false
});
// Add the search widget to the top left corner of the view
view.ui.add(searchWidget, {
position: "top-right"
});
// WIDGET de TOGGLE
view.ui.add(toggle, "top-right"); //Afegeixo widget de toggle a dalt a la dreta
});
function zoomToScale(zoom) {
// Pas de nivells de zoom a escala. E zoom no funciona amb webmaps coma mapa base
console.info("dins zoomToScale "+zoom);
var scale;
switch (zoom) {
case '20': scale = 1128.497220;break;
case '19': scale = 2256.994440;break;
case '18': scale = 4513.988880;break;
case '17': scale = 9027.977761;break;
case '16': scale = 18055.955520;break;
case '15': scale = 36111.911040;break;
case '14': scale = 72223.822090;break;
case '13': scale = 144447.644200;break;
case '12': scale = 288895.288400;break;
case '11': scale = 577790.576700;break;
case '10': scale = 1155581.153000;break;
case '9': scale = 2311162.307000;break;
case '8': scale = 4622324.614000;break;
case '7': scale = 9244649.227000;break;
case '6': scale = 18489298.450000;break;
case '5': scale = 36978596.910000;break;
case '4': scale = 73957193.820000;break;
case '3': scale = 147914387.600000;break;
case '2': scale = 295828775.300000;break;
case '1': scale = 591657550.500000;
}
return scale
}
</script>
</body>
</html>