@osimatic/helpers-js 1.4.10 → 1.4.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/open_street_map.js +47 -44
- package/package.json +1 -1
package/open_street_map.js
CHANGED
|
@@ -121,49 +121,51 @@ class OpenStreetMap {
|
|
|
121
121
|
map.setView([46.52863469527167, 2.43896484375], 6);
|
|
122
122
|
}
|
|
123
123
|
|
|
124
|
-
static
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
124
|
+
static getCountryBoundingBoxes() {
|
|
125
|
+
return {
|
|
126
|
+
// Europe
|
|
127
|
+
"fr": [[41.333, -5.142], [51.091, 9.559]], // France,
|
|
128
|
+
"de": [[47.270, 5.866], [55.058, 15.041]], // Germany
|
|
129
|
+
"es": [[27.642, -18.167], [43.792, 4.327]], // Spain incl. Canaries (approx)
|
|
130
|
+
"it": [[36.619, 6.627], [47.095, 18.520]], // Italy
|
|
131
|
+
"pt": [[36.840, -9.500], [42.280, -6.190]], // Portugal
|
|
132
|
+
"be": [[49.497, 2.545], [51.505, 6.407]], // Belgium
|
|
133
|
+
"nl": [[50.753, 3.358], [53.555, 7.227]], // Netherlands
|
|
134
|
+
"ch": [[45.818, 5.957], [47.808, 10.492]], // Switzerland
|
|
135
|
+
"at": [[46.372, 9.530], [49.021, 17.162]], // Austria
|
|
136
|
+
"gb": [[49.959, -8.649], [59.478, 1.759]], // United Kingdom,
|
|
137
|
+
"ie": [[51.390, -10.480], [55.387, -5.432]], // Ireland
|
|
138
|
+
"pl": [[49.003, 14.123], [54.836, 24.145]], // Poland
|
|
139
|
+
"se": [[55.340, 11.112], [69.061, 24.177]], // Sweden
|
|
140
|
+
"no": [[57.980, 4.500], [71.188, 31.078]], // Norway (Mainland approx)
|
|
141
|
+
"fi": [[59.810, 20.556], [70.092, 31.586]], // Finland
|
|
142
|
+
"dk": [[54.560, 8.089], [57.752, 12.690]], // Denmark
|
|
143
|
+
|
|
144
|
+
// Afrique / Moyen-Orient
|
|
145
|
+
"ma": [[27.662, -13.172], [35.922, -0.996]], // Morocco
|
|
146
|
+
"dz": [[18.976, -8.669], [37.093, 11.999]], // Algeria
|
|
147
|
+
"tn": [[30.233, 7.524], [37.544, 11.598]], // Tunisia
|
|
148
|
+
"eg": [[21.725, 24.700], [31.667, 36.895]], // Egypt
|
|
149
|
+
"za": [[-34.833, 16.470], [-22.126, 32.893]], // South Africa
|
|
150
|
+
"sa": [[15.615, 34.495], [32.154, 55.666]], // Saudi Arabia
|
|
151
|
+
"ae": [[22.634, 51.570], [26.084, 56.383]], // United Arab Emirates
|
|
152
|
+
"il": [[29.487, 34.268], [33.277, 35.876]], // Israel
|
|
153
|
+
|
|
154
|
+
// Amériques
|
|
155
|
+
"us": [[24.396, -124.848], [49.384, -66.885]], // United States (Contiguous)
|
|
156
|
+
"ca": [[41.675, -141.000], [83.113, -52.648]], // Canada
|
|
157
|
+
"mx": [[14.538, -118.365], [32.720, -86.711]], // Mexico
|
|
158
|
+
"br": [[-33.751, -73.987], [5.271, -34.729]], // Brazil
|
|
159
|
+
"ar": [[-55.051, -73.582], [-21.781, -53.591]], // Argentina
|
|
160
|
+
|
|
161
|
+
// Asie / Océanie
|
|
162
|
+
"cn": [[18.159, 73.499], [53.560, 134.772]], // China (mainland approx)
|
|
163
|
+
"in": [[6.554, 68.176], [35.674, 97.402]], // India
|
|
164
|
+
"jp": [[24.249, 122.938], [45.557, 153.987]], // Japan
|
|
165
|
+
"au": [[-43.740, 112.921], [-10.668, 153.639]], // Australia
|
|
166
|
+
"nz": [[-47.290, 166.509], [-34.392, 178.517]], // New Zealand
|
|
167
|
+
};
|
|
168
|
+
}
|
|
167
169
|
|
|
168
170
|
static getCountryBoundingBox(countryIsoCode) {
|
|
169
171
|
if (!countryIsoCode) {
|
|
@@ -171,7 +173,8 @@ class OpenStreetMap {
|
|
|
171
173
|
}
|
|
172
174
|
|
|
173
175
|
const key = countryIsoCode.toLowerCase().trim();
|
|
174
|
-
|
|
176
|
+
const countryBox = OpenStreetMap.getCountryBoundingBoxes()[key];
|
|
177
|
+
return countryBox ? countryBox : null;
|
|
175
178
|
}
|
|
176
179
|
|
|
177
180
|
static centerMapOnCountry(map, countryIsoCode, opts = {}) {
|