@pretto/places 0.28.0 → 0.31.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) hide show
  1. package/dist/config/constants.d.ts +7 -0
  2. package/dist/config/constants.d.ts.map +1 -0
  3. package/dist/index.d.ts +22 -5
  4. package/dist/index.d.ts.map +1 -1
  5. package/dist/index.js +216 -1090
  6. package/dist/lib/customFetch.d.ts +4 -0
  7. package/dist/lib/customFetch.d.ts.map +1 -0
  8. package/dist/lib/formatText.d.ts +2 -0
  9. package/dist/lib/formatText.d.ts.map +1 -0
  10. package/dist/lib/formatToMunicipalityResult.d.ts +3 -0
  11. package/dist/lib/formatToMunicipalityResult.d.ts.map +1 -0
  12. package/dist/lib/getSignal.d.ts +2 -0
  13. package/dist/lib/getSignal.d.ts.map +1 -0
  14. package/dist/lib/isStartWith.d.ts +2 -0
  15. package/dist/lib/isStartWith.d.ts.map +1 -0
  16. package/dist/module.js +213 -1088
  17. package/dist/searchByAddress.d.ts +3 -0
  18. package/dist/searchByAddress.d.ts.map +1 -0
  19. package/dist/searchByCoordinates.d.ts +3 -0
  20. package/dist/searchByCoordinates.d.ts.map +1 -0
  21. package/dist/searchByCountry.d.ts +11 -0
  22. package/dist/searchByCountry.d.ts.map +1 -0
  23. package/dist/searchByDepartment.d.ts +3 -0
  24. package/dist/searchByDepartment.d.ts.map +1 -0
  25. package/dist/searchByMunicipality.d.ts +3 -0
  26. package/dist/searchByMunicipality.d.ts.map +1 -0
  27. package/dist/searchByZipcode.d.ts +3 -0
  28. package/dist/searchByZipcode.d.ts.map +1 -0
  29. package/dist/types.d.ts +76 -0
  30. package/dist/types.d.ts.map +1 -0
  31. package/package.json +4 -2
  32. package/dist/addressSearch.d.ts +0 -27
  33. package/dist/addressSearch.d.ts.map +0 -1
  34. package/dist/countrySearch.d.ts +0 -20
  35. package/dist/countrySearch.d.ts.map +0 -1
  36. package/dist/geolocSearch.d.ts +0 -7
  37. package/dist/geolocSearch.d.ts.map +0 -1
  38. package/dist/municipalitySearch.d.ts +0 -42
  39. package/dist/municipalitySearch.d.ts.map +0 -1
  40. package/dist/outline/paris.d.ts +0 -8
  41. package/dist/outline/paris.d.ts.map +0 -1
  42. package/dist/reverseGeolocSearch.d.ts +0 -19
  43. package/dist/reverseGeolocSearch.d.ts.map +0 -1
  44. package/dist/utils.d.ts +0 -3
  45. package/dist/utils.d.ts.map +0 -1
package/dist/index.js CHANGED
@@ -2,17 +2,13 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var flat = require('array.prototype.flat');
6
- var isEqual = require('lodash.isequal');
7
5
  var algoliasearch = require('algoliasearch');
8
6
 
9
7
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
10
8
 
11
- var flat__default = /*#__PURE__*/_interopDefaultLegacy(flat);
12
- var isEqual__default = /*#__PURE__*/_interopDefaultLegacy(isEqual);
13
9
  var algoliasearch__default = /*#__PURE__*/_interopDefaultLegacy(algoliasearch);
14
10
 
15
- /*! *****************************************************************************
11
+ /******************************************************************************
16
12
  Copyright (c) Microsoft Corporation.
17
13
 
18
14
  Permission to use, copy, modify, and/or distribute this software for any
@@ -35,201 +31,204 @@ function __awaiter(thisArg, _arguments, P, generator) {
35
31
  function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
36
32
  step((generator = generator.apply(thisArg, _arguments || [])).next());
37
33
  });
38
- }
39
-
40
- const convertFirstLetterToUpperCase = (str) => {
41
- return [...str.toLowerCase()].reduce((acc, curr, idx, array) => {
42
- if (idx === 0)
43
- return curr.toUpperCase();
44
- if ([' ', '-', '('].indexOf(array[idx - 1]) !== -1)
45
- return acc + curr.toUpperCase();
46
- return acc + curr;
47
- }, '');
48
- };
49
- const getUri = (search, departmentOnly, withType = true) => {
50
- const PLACES_API = 'https://geo.api.gouv.fr';
51
- const QUERY_FIELDS = `boost=population&fields=departement${departmentOnly ? ',centre,contour' : ',codesPostaux,centre,contour'}`;
52
- const formatedSearch = encodeURIComponent(search);
53
- const type = withType ? 'type=arrondissement-municipal&' : '';
54
- const uri = {
55
- departments: `${PLACES_API}/departements/${formatedSearch}/communes?${QUERY_FIELDS}`,
56
- municipality: `${PLACES_API}/communes?${type}&nom=${formatedSearch}&${QUERY_FIELDS}`,
57
- zipcode: `${PLACES_API}/communes?${type}codePostal=${formatedSearch}&${QUERY_FIELDS}`,
58
- };
59
- if (isNaN(parseInt(search, 10)))
60
- return uri.municipality;
61
- return search.length === 5 ? uri.zipcode : uri.departments;
34
+ }
35
+
36
+ typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
37
+ var e = new Error(message);
38
+ return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
62
39
  };
63
40
 
64
- let PREVIOUS_SEARCH = [];
65
- let SEARCH_CACHE = [];
66
- let PREVIOUS_VALUE = '';
67
- const responseFormat = (places, country, search, departmentOnly) => {
68
- var _a;
69
- if (places.length === 0 || !places)
70
- return [];
71
- if (departmentOnly) {
72
- return places.map(place => {
73
- var _a, _b;
74
- const center = !(place === null || place === void 0 ? void 0 : place.centre)
75
- ? null
76
- : { latitude: place.centre.coordinates[1], longitude: place.centre.coordinates[0] };
77
- return {
78
- label: `${place.nom}${!!((_a = place.departement) === null || _a === void 0 ? void 0 : _a.code) ? ` (${place.departement.code})` : ''}`,
79
- value: {
80
- center,
81
- city: place.nom,
82
- country,
83
- outline: place.contour.coordinates[0].map(([longitude, latitude]) => ({ longitude, latitude })),
84
- zipcode: ((_b = place.departement) === null || _b === void 0 ? void 0 : _b.code) || '',
85
- },
86
- };
41
+ const MUNICIPALITY_API_URL = 'https://geo.api.gouv.fr/communes';
42
+ const DEPARTMENT_API_URL = 'https://geo.api.gouv.fr/departements';
43
+ const ADDRESS_API_URL = 'https://api-adresse.data.gouv.fr/search';
44
+ const FIELDS = '&fields=codeDepartement,nom,codesPostaux,contour,mairie,centre';
45
+ const BOOST = '&boost=population';
46
+ const TYPES = '&type=arrondissement-municipal,commune-actuelle';
47
+
48
+ const DEFAULT_DEBOUNCE_TIME = 300;
49
+ let getDelayedData;
50
+ function customFetch(url, options = { debouncetime: DEFAULT_DEBOUNCE_TIME }) {
51
+ return __awaiter(this, void 0, void 0, function* () {
52
+ clearTimeout(getDelayedData);
53
+ return new Promise((resolve, reject) => {
54
+ getDelayedData = setTimeout(() => __awaiter(this, void 0, void 0, function* () {
55
+ const fetchData = (singleUrl) => __awaiter(this, void 0, void 0, function* () {
56
+ const response = yield fetch(singleUrl, { signal: options.signal });
57
+ if (!response.ok) {
58
+ throw new Error('Error: ' + response.status);
59
+ }
60
+ return response;
61
+ });
62
+ try {
63
+ if (Array.isArray(url)) {
64
+ const responses = yield Promise.all(url.map(singleUrl => fetchData(singleUrl)));
65
+ resolve(responses);
66
+ }
67
+ else {
68
+ const response = yield fetchData(url);
69
+ resolve(response);
70
+ }
71
+ }
72
+ catch (error) {
73
+ reject(error);
74
+ }
75
+ }), options.debouncetime);
87
76
  });
77
+ });
78
+ }
79
+
80
+ const getSignal = (controller) => {
81
+ if (controller) {
82
+ controller.abort();
88
83
  }
89
- if (!isNaN(parseInt(search, 10)) && search.length === 5 && places.length === 1) {
90
- const center = !((_a = places[0]) === null || _a === void 0 ? void 0 : _a.centre)
91
- ? null
92
- : { latitude: places[0].centre.coordinates[1], longitude: places[0].centre.coordinates[0] };
84
+ controller = new AbortController();
85
+ return controller.signal;
86
+ };
87
+
88
+ let controller$4 = null;
89
+ const searchByAddress = (searchValue, options) => __awaiter(void 0, void 0, void 0, function* () {
90
+ const url = `${ADDRESS_API_URL}/?q=${searchValue}&autocomplete=1&limit=${(options === null || options === void 0 ? void 0 : options.limit) || 10}`;
91
+ const signal = (options === null || options === void 0 ? void 0 : options.signal) || getSignal(controller$4);
92
+ const addressResponse = yield customFetch(url, Object.assign(Object.assign({}, options), { signal }));
93
+ const addressResult = yield addressResponse.json();
94
+ const formatAddressResult = addressResult.features.reduce((acc, { properties }) => {
93
95
  return [
96
+ ...acc,
94
97
  {
95
- label: `${places[0].nom} (${search})`,
98
+ label: `${properties.name} ${properties.postcode}, ${properties.city}`,
96
99
  value: {
97
- center,
98
- city: places[0].nom,
99
- country,
100
- outline: places[0].contour.coordinates[0].map(([longitude, latitude]) => ({ longitude, latitude })),
101
- zipcode: search,
100
+ city: properties.city,
101
+ country: 'fr',
102
+ street: `${properties.name}`,
103
+ zipcode: properties.postcode,
102
104
  },
103
105
  },
104
106
  ];
105
- }
106
- const allPlaces = places.map(place => {
107
- return place.codesPostaux.reduce((acc, curr) => {
108
- const center = !(place === null || place === void 0 ? void 0 : place.centre)
109
- ? null
110
- : { latitude: place.centre.coordinates[1], longitude: place.centre.coordinates[0] };
111
- return [
112
- ...acc,
113
- {
114
- label: `${place.nom} (${curr})`,
115
- value: {
116
- center,
117
- city: place.nom,
118
- country,
119
- outline: place.contour.coordinates[0].map(([longitude, latitude]) => ({ longitude, latitude })),
120
- zipcode: curr,
121
- },
122
- },
123
- ];
124
- }, []);
125
- });
126
- return flat__default["default"](allPlaces);
107
+ }, []);
108
+ return formatAddressResult;
109
+ });
110
+
111
+ const formatToMunicipalitySearchResult = (results) => {
112
+ return results.map(result => ({
113
+ label: result.nom + ' ' + result.codesPostaux[0],
114
+ value: {
115
+ center: result.centre,
116
+ city: result.nom,
117
+ country: 'fr',
118
+ outline: result.contour.coordinates[0].map(([longitude, latitude]) => ({ longitude, latitude })),
119
+ zipcode: result.codesPostaux[0],
120
+ },
121
+ }));
127
122
  };
128
- const getData$3 = (search, options) => __awaiter(void 0, void 0, void 0, function* () {
129
- const { country = 'fr', limit = 5, departmentOnly = false } = options || {};
130
- const isNumber = !isNaN(parseInt(search, 10));
131
- if (!search || (isNumber && search.length < 2))
132
- return [];
133
- if (isNumber && search.length > 2 && search.length < 5 && SEARCH_CACHE.length > 0) {
134
- return SEARCH_CACHE.filter(i => i.value.zipcode.includes(search)).slice(0, limit);
135
- }
123
+
124
+ let controller$3 = null;
125
+ const searchByCoordinates = ({ latitude, longitude }, options) => __awaiter(void 0, void 0, void 0, function* () {
126
+ const url = `${MUNICIPALITY_API_URL}?lat=${latitude}&lon=${longitude}${FIELDS}${BOOST}`;
127
+ const signal = (options === null || options === void 0 ? void 0 : options.signal) || getSignal(controller$3);
136
128
  try {
137
- let result = [];
138
- const response = yield fetch(getUri(search, departmentOnly));
139
- if (!response.ok)
140
- return Promise.reject(response);
141
- result = yield response.json();
142
- if (result.length === 0) {
143
- const response = yield fetch(getUri(search, departmentOnly, false));
144
- if (!response.ok)
145
- return Promise.reject(response);
146
- result = yield response.json();
147
- }
148
- const formatedResponse = responseFormat(result, country, search, departmentOnly);
149
- if (isEqual__default["default"](PREVIOUS_SEARCH, formatedResponse)) {
150
- const cleanValue = search.replace(' ', '').replace(PREVIOUS_VALUE, '');
151
- return PREVIOUS_SEARCH.filter(i => i.label.includes(cleanValue)).slice(0, limit);
152
- }
153
- PREVIOUS_VALUE = search;
154
- PREVIOUS_SEARCH = formatedResponse;
155
- if (isNumber && search.length !== 5) {
156
- SEARCH_CACHE = formatedResponse;
157
- }
158
- return formatedResponse.slice(0, limit);
129
+ const gpsResponse = yield customFetch([url + TYPES, url], Object.assign(Object.assign({}, options), { signal }));
130
+ const arrondissementsResponse = yield gpsResponse[0].json();
131
+ const communeResponse = yield gpsResponse[1].json();
132
+ const result = arrondissementsResponse.length > 0 ? arrondissementsResponse : communeResponse;
133
+ return formatToMunicipalitySearchResult(result);
159
134
  }
160
135
  catch (error) {
161
- if (typeof error === 'string')
162
- throw new Error(error);
163
- if (error instanceof Error)
164
- throw new Error((error === null || error === void 0 ? void 0 : error.message) || 'An error occurred.');
165
- return 'An error occurred.';
136
+ console.log(error);
137
+ return [];
166
138
  }
167
139
  });
168
- let getDelayedData$3;
169
- const get$4 = (search, options, debounceValue = 300) => {
170
- clearTimeout(getDelayedData$3);
171
- return new Promise((resolve, reject) => {
172
- getDelayedData$3 = setTimeout(() => {
173
- resolve(getData$3(search, options));
174
- }, debounceValue);
175
- });
176
- };
177
140
 
178
- var municipalitySearch = /*#__PURE__*/Object.freeze({
179
- __proto__: null,
180
- getData: getData$3,
181
- get: get$4
141
+ let controller$2 = null;
142
+ const searchByDepartment = (searchValue, options) => __awaiter(void 0, void 0, void 0, function* () {
143
+ if (isNaN(parseInt(searchValue))) {
144
+ const nameDepartmentUrl = `${DEPARTMENT_API_URL}?nom=${searchValue}&fields=region,codeRegion&limit=21`;
145
+ const signal = (options === null || options === void 0 ? void 0 : options.signal) || getSignal(controller$2);
146
+ const departmentResponse = yield customFetch(nameDepartmentUrl, Object.assign(Object.assign({}, options), { signal }));
147
+ const departmentResult = yield departmentResponse.json();
148
+ return departmentResult.map(result => ({
149
+ label: `${result.nom} (${result.code})`,
150
+ value: {
151
+ code: result.code,
152
+ codeRegion: result.codeRegion,
153
+ country: 'fr',
154
+ region: result.region,
155
+ },
156
+ }));
157
+ }
158
+ const codeDepartmentUrl = `${DEPARTMENT_API_URL}/${searchValue}?limit=1`;
159
+ const departmentResponse = yield customFetch(codeDepartmentUrl, options);
160
+ const departmentResult = yield departmentResponse.json();
161
+ if ('nom' in departmentResult) {
162
+ return searchByDepartment(departmentResult.nom, options);
163
+ }
164
+ return [];
182
165
  });
183
166
 
184
- const getData$2 = (search, options) => __awaiter(void 0, void 0, void 0, function* () {
185
- if (!search || search.length < 2)
186
- return [];
187
- try {
188
- const { country = 'fr', limit = 5 } = options || {};
189
- const format = encodeURIComponent(search);
190
- const response = yield fetch(`https://api-adresse.data.gouv.fr/search/?q=${format}&autocomplete=1&limit=${limit}`);
191
- if (!response.ok)
192
- return Promise.reject(response);
193
- const result = yield response.json();
194
- return result.features.reduce((acc, { properties }) => {
195
- return [
196
- ...acc,
197
- {
198
- label: `${properties.name} (${properties.postcode})`,
199
- value: {
200
- city: properties.city,
201
- country,
202
- street: `${properties.name}`,
203
- zipcode: properties.postcode,
204
- },
205
- },
206
- ];
207
- }, []);
167
+ function isStartsWith(arr, value) {
168
+ const lowerCaseValue = value.toLowerCase();
169
+ return arr.some(item => lowerCaseValue.startsWith(item.toLowerCase()));
170
+ }
171
+
172
+ const SPECIAL_CITIES = ['paris ', 'lyon ', 'marseille '];
173
+ let CURRENT_RESULT = [];
174
+ let controller$1 = null;
175
+ const filterOnCurrentResult = (searchValue) => {
176
+ const searchRegex = new RegExp(searchValue
177
+ .split(' ')
178
+ .map(word => `(?=.*${word})`)
179
+ .join(''), 'i');
180
+ return CURRENT_RESULT.filter(item => searchRegex.test(item.nom));
181
+ };
182
+ const filterCityResults = (cities) => cities.filter(city => !(['75', '13', '69'].includes(city.codeDepartement) && city.codesPostaux.length > 1));
183
+ const searchByMunicipality = (searchValue, options) => __awaiter(void 0, void 0, void 0, function* () {
184
+ if (isStartsWith(SPECIAL_CITIES, searchValue.toLowerCase()) && CURRENT_RESULT.length > 0) {
185
+ const filtredCurrentResult = filterOnCurrentResult(searchValue);
186
+ return formatToMunicipalitySearchResult(filtredCurrentResult);
208
187
  }
209
- catch (error) {
210
- if (typeof error === 'string')
211
- throw new Error(error);
212
- if (error instanceof Error)
213
- throw new Error((error === null || error === void 0 ? void 0 : error.message) || 'An error occurred.');
214
- return 'An error occurred.';
188
+ CURRENT_RESULT = [];
189
+ const url = `${MUNICIPALITY_API_URL}?nom=${searchValue}${FIELDS}${BOOST}&limit=${(options === null || options === void 0 ? void 0 : options.limit) || 10}`;
190
+ const signal = (options === null || options === void 0 ? void 0 : options.signal) || getSignal(controller$1);
191
+ const cityResponse = yield customFetch(url, Object.assign(Object.assign({}, options), { signal }));
192
+ const cityResult = yield cityResponse.json();
193
+ // The first result is Paris, Lyon or Marseille, we want get all arrondissements
194
+ if (cityResult.length > 0 && ['75', '13', '69'].includes(cityResult[0].codeDepartement)) {
195
+ const url = `${MUNICIPALITY_API_URL}?nom=${searchValue}&codeDepartement=${cityResult[0].codeDepartement}${FIELDS}${BOOST}${TYPES}&limit=21`;
196
+ const arrondissementsResponse = yield customFetch(url, options);
197
+ const arrondissementsResult = yield arrondissementsResponse.json();
198
+ const filtredAndSortArrondissementsResult = arrondissementsResult
199
+ .filter(item => item.codesPostaux.length === 1)
200
+ .sort((a, b) => parseInt(a.codesPostaux[0]) - parseInt(b.codesPostaux[0]));
201
+ CURRENT_RESULT = filtredAndSortArrondissementsResult;
202
+ if (isStartsWith(SPECIAL_CITIES, searchValue.toLowerCase())) {
203
+ const filtredCurrentResult = filterOnCurrentResult(searchValue);
204
+ return formatToMunicipalitySearchResult(filtredCurrentResult);
205
+ }
206
+ return formatToMunicipalitySearchResult(filterCityResults([...filtredAndSortArrondissementsResult, ...cityResult]));
215
207
  }
208
+ return formatToMunicipalitySearchResult(filterCityResults(cityResult));
216
209
  });
217
- let getDelayedData$2;
218
- const get$3 = (search, options, debounceValue = 300) => {
219
- clearTimeout(getDelayedData$2);
220
- return new Promise((resolve, reject) => {
221
- getDelayedData$2 = setTimeout(() => {
222
- resolve(getData$2(search, options));
223
- }, debounceValue);
224
- });
225
- };
226
210
 
227
- var addressSearch = /*#__PURE__*/Object.freeze({
228
- __proto__: null,
229
- get: get$3
211
+ let controller = null;
212
+ const searchByZipcode = (searchValue, options) => __awaiter(void 0, void 0, void 0, function* () {
213
+ const url = `${MUNICIPALITY_API_URL}?codePostal=${searchValue}${FIELDS}${BOOST}${TYPES}`;
214
+ const signal = (options === null || options === void 0 ? void 0 : options.signal) || getSignal(controller);
215
+ const zipCodeResponse = yield customFetch(url, Object.assign(Object.assign({}, options), { signal }));
216
+ const zipCodeResult = yield zipCodeResponse.json();
217
+ const filtredZipCodeResult = zipCodeResult.filter(item => item.codesPostaux.length <= 1);
218
+ return formatToMunicipalitySearchResult(filtredZipCodeResult);
230
219
  });
231
220
 
232
- const get$2 = (instance, search, options) => __awaiter(void 0, void 0, void 0, function* () {
221
+ const convertFirstLetterToUpperCase = (str) => {
222
+ return [...str.toLowerCase()].reduce((acc, curr, idx, array) => {
223
+ if (idx === 0)
224
+ return curr.toUpperCase();
225
+ if ([' ', '-', '('].indexOf(array[idx - 1]) !== -1)
226
+ return acc + curr.toUpperCase();
227
+ return acc + curr;
228
+ }, '');
229
+ };
230
+
231
+ const get = (instance, search, options) => __awaiter(void 0, void 0, void 0, function* () {
233
232
  const selectedLanguage = (options === null || options === void 0 ? void 0 : options.language) || 'fr';
234
233
  const indexName = selectedLanguage === 'fr' ? 'Countries' : 'CountriesEN';
235
234
  if (!search)
@@ -253,7 +252,7 @@ const init = (appId, apiKey, options) => {
253
252
  return {
254
253
  get(search, options) {
255
254
  return __awaiter(this, void 0, void 0, function* () {
256
- return yield get$2(ALGOLIA_COUNTRIES_API, search, options);
255
+ return yield get(ALGOLIA_COUNTRIES_API, search, options);
257
256
  });
258
257
  },
259
258
  };
@@ -267,937 +266,64 @@ const init = (appId, apiKey, options) => {
267
266
  }
268
267
  };
269
268
 
270
- var countrySearch = /*#__PURE__*/Object.freeze({
269
+ var searchByCountry = /*#__PURE__*/Object.freeze({
271
270
  __proto__: null,
272
271
  init: init
273
272
  });
274
273
 
275
- const formatData$1 = (results) => results.map(result => ({
276
- city: result.nom,
277
- code: result.code,
278
- coordinates: result.centre.coordinates,
279
- }));
280
- // All french zipcode are only numbers, even particular cases like Corse (2A, 2B > 20), Finistère (29N, 29S > 29x), etc..
281
- // For more information: https://fr.wikipedia.org/wiki/Code_postal_en_France
282
- // Kept as string for consistency with geo.api.gouv.fr
283
- const getData$1 = (search) => __awaiter(void 0, void 0, void 0, function* () {
284
- if (!search || !/(\d){5}/.test(search))
274
+ const searchPlaces = (searchValue, options, searchType = ['city', 'zipcode', 'coordinates']) => __awaiter(void 0, void 0, void 0, function* () {
275
+ if (!searchValue) {
285
276
  return [];
277
+ }
286
278
  try {
287
- let results = [];
288
- const formattedSearch = encodeURIComponent(search);
289
- const response = yield fetch(`https://geo.api.gouv.fr/communes?codePostal=${formattedSearch}&type=arrondissement-municipal&fields=centre`);
290
- if (!response.ok)
291
- return Promise.reject(response);
292
- results = yield response.json();
293
- if (results.length === 0) {
294
- const response = yield fetch(`https://geo.api.gouv.fr/communes?codePostal=${formattedSearch}&fields=centre`);
295
- if (!response.ok)
296
- return Promise.reject(response);
297
- results = yield response.json();
279
+ if (typeof searchValue === 'object' && searchType.includes('coordinates')) {
280
+ const result = yield searchByCoordinates(searchValue, options);
281
+ return result;
298
282
  }
299
- return formatData$1(results);
300
- }
301
- catch (error) {
302
- if (typeof error === 'string')
303
- throw new Error(error);
304
- throw new Error(error instanceof Error && error.message ? error.message : 'An error occurred.');
305
- }
306
- });
307
- let getDelayedData$1;
308
- const get$1 = (search, debounceValue = 300) => {
309
- clearTimeout(getDelayedData$1);
310
- return new Promise((resolve, reject) => {
311
- getDelayedData$1 = setTimeout(() => {
312
- resolve(getData$1(search));
313
- }, debounceValue);
314
- });
315
- };
316
-
317
- var geolocSearch = /*#__PURE__*/Object.freeze({
318
- __proto__: null,
319
- get: get$1
320
- });
321
-
322
- const parisOutline = [
323
- {
324
- name: '75001',
325
- coordinates: [
326
- { latitude: 48.86957652371833, longitude: 2.325888016639641 },
327
- { latitude: 48.86941686979254, longitude: 2.325166186173742 },
328
- { latitude: 48.869012125448094, longitude: 2.325318661731758 },
329
- { latitude: 48.86647318158315, longitude: 2.323549402969781 },
330
- { latitude: 48.86301926292805, longitude: 2.320933472558735 },
331
- { latitude: 48.860820561109485, longitude: 2.327980452922264 },
332
- { latitude: 48.85967940127131, longitude: 2.331211887811374 },
333
- { latitude: 48.85933546785559, longitude: 2.332915970801086 },
334
- { latitude: 48.85831054598589, longitude: 2.337672258257702 },
335
- { latitude: 48.856675326020245, longitude: 2.340567474956991 },
336
- { latitude: 48.85612842977291, longitude: 2.341367616268793 },
337
- { latitude: 48.85510403355428, longitude: 2.342506315232651 },
338
- { latitude: 48.854832954713046, longitude: 2.342929504859985 },
339
- { latitude: 48.85408864570293, longitude: 2.344634297019094 },
340
- { latitude: 48.855305967418026, longitude: 2.345875578039897 },
341
- { latitude: 48.85724094546822, longitude: 2.347114738902889 },
342
- { latitude: 48.85735856694371, longitude: 2.347573942712777 },
343
- { latitude: 48.86198542309833, longitude: 2.350164450262719 },
344
- { latitude: 48.86340168752486, longitude: 2.350955108041353 },
345
- { latitude: 48.86826017309677, longitude: 2.330425554638063 },
346
- { latitude: 48.86840948237775, longitude: 2.330107362963977 },
347
- { latitude: 48.86992115311998, longitude: 2.327999372502886 },
348
- { latitude: 48.86957652371833, longitude: 2.325888016639641 },
349
- ],
350
- },
351
- {
352
- name: '75002',
353
- coordinates: [
354
- { latitude: 48.86992115311998, longitude: 2.327999372502886 },
355
- { latitude: 48.86840948237775, longitude: 2.330107362963977 },
356
- { latitude: 48.86826017309677, longitude: 2.330425554638063 },
357
- { latitude: 48.86340168752486, longitude: 2.350955108041353 },
358
- { latitude: 48.869323712716465, longitude: 2.35425267163513 },
359
- { latitude: 48.870687845194766, longitude: 2.347918228212595 },
360
- { latitude: 48.871972099441614, longitude: 2.340041163195277 },
361
- { latitude: 48.86992115311998, longitude: 2.327999372502886 },
362
- ],
363
- },
364
- {
365
- name: '75003',
366
- coordinates: [
367
- { latitude: 48.86751628680611, longitude: 2.363872116727158 },
368
- { latitude: 48.86781627185984, longitude: 2.363290446814835 },
369
- { latitude: 48.86882946521955, longitude: 2.356495893113925 },
370
- { latitude: 48.869323712716465, longitude: 2.35425267163513 },
371
- { latitude: 48.86340168752486, longitude: 2.350955108041353 },
372
- { latitude: 48.86198542309833, longitude: 2.350164450262719 },
373
- { latitude: 48.86121296232192, longitude: 2.353499932088789 },
374
- { latitude: 48.86014672001949, longitude: 2.356742165886385 },
375
- { latitude: 48.8583394999781, longitude: 2.359344591623221 },
376
- { latitude: 48.85724355063003, longitude: 2.36176775751168 },
377
- { latitude: 48.856306224209064, longitude: 2.36494121805568 },
378
- { latitude: 48.85578517844436, longitude: 2.36827851557945 },
379
- { latitude: 48.855805185784135, longitude: 2.368490886682737 },
380
- { latitude: 48.86307619289049, longitude: 2.366747947246461 },
381
- { latitude: 48.86616998447825, longitude: 2.364890494038093 },
382
- { latitude: 48.86730904970824, longitude: 2.364306784904801 },
383
- { latitude: 48.86751628680611, longitude: 2.363872116727158 },
384
- ],
385
- },
386
- {
387
- name: '75004',
388
- coordinates: [
389
- { latitude: 48.8531662305869, longitude: 2.369123881441927 },
390
- { latitude: 48.855805185784135, longitude: 2.368490886682737 },
391
- { latitude: 48.85578517844436, longitude: 2.36827851557945 },
392
- { latitude: 48.856306224209064, longitude: 2.36494121805568 },
393
- { latitude: 48.85724355063003, longitude: 2.36176775751168 },
394
- { latitude: 48.8583394999781, longitude: 2.359344591623221 },
395
- { latitude: 48.86014672001949, longitude: 2.356742165886385 },
396
- { latitude: 48.86121296232192, longitude: 2.353499932088789 },
397
- { latitude: 48.86198542309833, longitude: 2.350164450262719 },
398
- { latitude: 48.85735856694371, longitude: 2.347573942712777 },
399
- { latitude: 48.85724094546822, longitude: 2.347114738902889 },
400
- { latitude: 48.855305967418026, longitude: 2.345875578039897 },
401
- { latitude: 48.85408864570293, longitude: 2.344634297019094 },
402
- { latitude: 48.853399201086006, longitude: 2.346673612596327 },
403
- { latitude: 48.85236336321757, longitude: 2.3490238379796 },
404
- { latitude: 48.851688322372794, longitude: 2.351245463223946 },
405
- { latitude: 48.85098606491656, longitude: 2.354597116127078 },
406
- { latitude: 48.849427619946795, longitude: 2.359308341799822 },
407
- { latitude: 48.84855560655669, longitude: 2.361057893168453 },
408
- { latitude: 48.847811960431926, longitude: 2.362260736113708 },
409
- { latitude: 48.846185908499045, longitude: 2.364455435684601 },
410
- { latitude: 48.847309858182896, longitude: 2.366443514943608 },
411
- { latitude: 48.8531662305869, longitude: 2.369123881441927 },
412
- ],
413
- },
414
- {
415
- name: '75005',
416
- coordinates: [
417
- { latitude: 48.846185908499045, longitude: 2.364455435684601 },
418
- { latitude: 48.847811960431926, longitude: 2.362260736113708 },
419
- { latitude: 48.84855560655669, longitude: 2.361057893168453 },
420
- { latitude: 48.849427619946795, longitude: 2.359308341799822 },
421
- { latitude: 48.85098606491656, longitude: 2.354597116127078 },
422
- { latitude: 48.851688322372794, longitude: 2.351245463223946 },
423
- { latitude: 48.85236336321757, longitude: 2.3490238379796 },
424
- { latitude: 48.853399201086006, longitude: 2.346673612596327 },
425
- { latitude: 48.85408864570293, longitude: 2.344634297019094 },
426
- { latitude: 48.853756649406066, longitude: 2.344281403902506 },
427
- { latitude: 48.85034803298138, longitude: 2.342631736794723 },
428
- { latitude: 48.846709989769, longitude: 2.340482359554029 },
429
- { latitude: 48.84087508203468, longitude: 2.337256165772474 },
430
- { latitude: 48.84074558478256, longitude: 2.336771393206437 },
431
- { latitude: 48.83967110759586, longitude: 2.336656991547953 },
432
- { latitude: 48.838863210249016, longitude: 2.33969740550839 },
433
- { latitude: 48.83834304474304, longitude: 2.3420855672544 },
434
- { latitude: 48.8373159561145, longitude: 2.347007359776023 },
435
- { latitude: 48.83680458564547, longitude: 2.351870772035156 },
436
- { latitude: 48.83994070616588, longitude: 2.361745287380767 },
437
- { latitude: 48.84441324001663, longitude: 2.365127018289573 },
438
- { latitude: 48.84496784315353, longitude: 2.36608772597324 },
439
- { latitude: 48.846185908499045, longitude: 2.364455435684601 },
440
- ],
441
- },
442
- {
443
- name: '75006',
444
- coordinates: [
445
- { latitude: 48.85933546785559, longitude: 2.332915970801086 },
446
- { latitude: 48.85853065910707, longitude: 2.332451956624262 },
447
- { latitude: 48.858290596608704, longitude: 2.333270093392227 },
448
- { latitude: 48.85511182678856, longitude: 2.330771694941244 },
449
- { latitude: 48.852730724714114, longitude: 2.329395832185783 },
450
- { latitude: 48.852055672942136, longitude: 2.328659059558951 },
451
- { latitude: 48.85186769794419, longitude: 2.328657392915725 },
452
- { latitude: 48.8515812406585, longitude: 2.326814484762852 },
453
- { latitude: 48.851362150651724, longitude: 2.326877278259198 },
454
- { latitude: 48.85023523821869, longitude: 2.324162209437007 },
455
- { latitude: 48.84791387995067, longitude: 2.3195413908368 },
456
- { latitude: 48.8468634910953, longitude: 2.316712552321029 },
457
- { latitude: 48.84663569580366, longitude: 2.31698262350471 },
458
- { latitude: 48.84516563132351, longitude: 2.319893405967863 },
459
- { latitude: 48.84362134269369, longitude: 2.324641767064502 },
460
- { latitude: 48.83967110759586, longitude: 2.336656991547953 },
461
- { latitude: 48.84074558478256, longitude: 2.336771393206437 },
462
- { latitude: 48.84087508203468, longitude: 2.337256165772474 },
463
- { latitude: 48.846709989769, longitude: 2.340482359554029 },
464
- { latitude: 48.85034803298138, longitude: 2.342631736794723 },
465
- { latitude: 48.853756649406066, longitude: 2.344281403902506 },
466
- { latitude: 48.85408864570293, longitude: 2.344634297019094 },
467
- { latitude: 48.854832954713046, longitude: 2.342929504859985 },
468
- { latitude: 48.85510403355428, longitude: 2.342506315232651 },
469
- { latitude: 48.85612842977291, longitude: 2.341367616268793 },
470
- { latitude: 48.856675326020245, longitude: 2.340567474956991 },
471
- { latitude: 48.85831054598589, longitude: 2.337672258257702 },
472
- { latitude: 48.85933546785559, longitude: 2.332915970801086 },
473
- ],
474
- },
475
- {
476
- name: '75007',
477
- coordinates: [
478
- { latitude: 48.86301926292805, longitude: 2.320933472558735 },
479
- { latitude: 48.86372322409194, longitude: 2.318677870940691 },
480
- { latitude: 48.863496076964175, longitude: 2.301737287583634 },
481
- { latitude: 48.86328352059519, longitude: 2.299222465550165 },
482
- { latitude: 48.863144008401505, longitude: 2.298589132813498 },
483
- { latitude: 48.86261949443383, longitude: 2.296870514172013 },
484
- { latitude: 48.861875619399484, longitude: 2.294864562062728 },
485
- { latitude: 48.861246340432466, longitude: 2.293689941916094 },
486
- { latitude: 48.860253620211, longitude: 2.292195882851742 },
487
- { latitude: 48.85818288040792, longitude: 2.289695682973308 },
488
- { latitude: 48.857475043730936, longitude: 2.291053303527222 },
489
- { latitude: 48.85138469655275, longitude: 2.3005463196733 },
490
- { latitude: 48.8510622115364, longitude: 2.301227956943836 },
491
- { latitude: 48.84713344729916, longitude: 2.307354149221546 },
492
- { latitude: 48.847433437634464, longitude: 2.308218200598362 },
493
- { latitude: 48.84797630479076, longitude: 2.310494899377193 },
494
- { latitude: 48.84594337806365, longitude: 2.313715867497841 },
495
- { latitude: 48.8468634910953, longitude: 2.316712552321029 },
496
- { latitude: 48.84791387995067, longitude: 2.3195413908368 },
497
- { latitude: 48.85023523821869, longitude: 2.324162209437007 },
498
- { latitude: 48.851362150651724, longitude: 2.326877278259198 },
499
- { latitude: 48.8515812406585, longitude: 2.326814484762852 },
500
- { latitude: 48.85186769794419, longitude: 2.328657392915725 },
501
- { latitude: 48.852055672942136, longitude: 2.328659059558951 },
502
- { latitude: 48.852730724714114, longitude: 2.329395832185783 },
503
- { latitude: 48.85511182678856, longitude: 2.330771694941244 },
504
- { latitude: 48.858290596608704, longitude: 2.333270093392227 },
505
- { latitude: 48.85853065910707, longitude: 2.332451956624262 },
506
- { latitude: 48.85933546785559, longitude: 2.332915970801086 },
507
- { latitude: 48.85967940127131, longitude: 2.331211887811374 },
508
- { latitude: 48.860820561109485, longitude: 2.327980452922264 },
509
- { latitude: 48.86301926292805, longitude: 2.320933472558735 },
510
- ],
511
- },
512
- {
513
- name: '75008',
514
- coordinates: [
515
- { latitude: 48.88345508679081, longitude: 2.327164725373034 },
516
- { latitude: 48.88134138388508, longitude: 2.316479725210514 },
517
- { latitude: 48.88043436140222, longitude: 2.308874779443685 },
518
- { latitude: 48.87807688568086, longitude: 2.29815486307795 },
519
- { latitude: 48.87377317675925, longitude: 2.295032069299387 },
520
- { latitude: 48.87330312962187, longitude: 2.295542880656993 },
521
- { latitude: 48.87093857212867, longitude: 2.297501223263733 },
522
- { latitude: 48.868644254049464, longitude: 2.298866790658252 },
523
- { latitude: 48.86553729851455, longitude: 2.29983829121079 },
524
- { latitude: 48.864986916136104, longitude: 2.299841599006072 },
525
- { latitude: 48.8650075721619, longitude: 2.300297979606478 },
526
- { latitude: 48.86449106268491, longitude: 2.301635346720621 },
527
- { latitude: 48.863496076964175, longitude: 2.301737287583634 },
528
- { latitude: 48.86372322409194, longitude: 2.318677870940691 },
529
- { latitude: 48.86301926292805, longitude: 2.320933472558735 },
530
- { latitude: 48.86647318158315, longitude: 2.323549402969781 },
531
- { latitude: 48.869012125448094, longitude: 2.325318661731758 },
532
- { latitude: 48.86941686979254, longitude: 2.325166186173742 },
533
- { latitude: 48.86957652371833, longitude: 2.325888016639641 },
534
- { latitude: 48.87259790076228, longitude: 2.326613754960452 },
535
- { latitude: 48.87276167043616, longitude: 2.32646984849174 },
536
- { latitude: 48.87342696649887, longitude: 2.326911159247377 },
537
- { latitude: 48.8737810482106, longitude: 2.327025197965383 },
538
- { latitude: 48.87535450560443, longitude: 2.326636742372628 },
539
- { latitude: 48.87618413885571, longitude: 2.326875527168119 },
540
- { latitude: 48.88345508679081, longitude: 2.327164725373034 },
541
- ],
542
- },
543
- {
544
- name: '75009',
545
- coordinates: [
546
- { latitude: 48.86957652371833, longitude: 2.325888016639641 },
547
- { latitude: 48.86992115311998, longitude: 2.327999372502886 },
548
- { latitude: 48.871972099441614, longitude: 2.340041163195277 },
549
- { latitude: 48.870687845194766, longitude: 2.347918228212595 },
550
- { latitude: 48.87401890252242, longitude: 2.347901065991873 },
551
- { latitude: 48.875483531082025, longitude: 2.348159503994068 },
552
- { latitude: 48.876082639873374, longitude: 2.348352431817903 },
553
- { latitude: 48.877528529751466, longitude: 2.349134703151032 },
554
- { latitude: 48.879103264973295, longitude: 2.349300461788451 },
555
- { latitude: 48.88064322368599, longitude: 2.349852552535392 },
556
- { latitude: 48.88348014130957, longitude: 2.349600316361947 },
557
- { latitude: 48.883724923006355, longitude: 2.34946498589375 },
558
- { latitude: 48.88341423078806, longitude: 2.346909326916857 },
559
- { latitude: 48.88202355548529, longitude: 2.33980196854301 },
560
- { latitude: 48.882386207496275, longitude: 2.337400148117986 },
561
- { latitude: 48.883825698481346, longitude: 2.332482251093436 },
562
- { latitude: 48.88458988070801, longitude: 2.329540571639999 },
563
- { latitude: 48.88370687653772, longitude: 2.328121477639862 },
564
- { latitude: 48.88350780062572, longitude: 2.327423135703935 },
565
- { latitude: 48.88345508679081, longitude: 2.327164725373034 },
566
- { latitude: 48.87618413885571, longitude: 2.326875527168119 },
567
- { latitude: 48.87535450560443, longitude: 2.326636742372628 },
568
- { latitude: 48.8737810482106, longitude: 2.327025197965383 },
569
- { latitude: 48.87342696649887, longitude: 2.326911159247377 },
570
- { latitude: 48.87276167043616, longitude: 2.32646984849174 },
571
- { latitude: 48.87259790076228, longitude: 2.326613754960452 },
572
- { latitude: 48.86957652371833, longitude: 2.325888016639641 },
573
- ],
574
- },
575
- {
576
- name: '75010',
577
- coordinates: [
578
- { latitude: 48.870687845194766, longitude: 2.347918228212595 },
579
- { latitude: 48.869323712716465, longitude: 2.35425267163513 },
580
- { latitude: 48.86882946521955, longitude: 2.356495893113925 },
581
- { latitude: 48.86781627185984, longitude: 2.363290446814835 },
582
- { latitude: 48.86751628680611, longitude: 2.363872116727158 },
583
- { latitude: 48.86823693070764, longitude: 2.365617798452501 },
584
- { latitude: 48.86881945661765, longitude: 2.36761059037576 },
585
- { latitude: 48.86948519613973, longitude: 2.369358394801618 },
586
- { latitude: 48.87072296605545, longitude: 2.373350142111482 },
587
- { latitude: 48.87204825945157, longitude: 2.376904765014237 },
588
- { latitude: 48.87799062237773, longitude: 2.370290292159464 },
589
- { latitude: 48.882467160769735, longitude: 2.37022798018227 },
590
- { latitude: 48.88284025325768, longitude: 2.370032562091205 },
591
- { latitude: 48.88331304763526, longitude: 2.369301392563939 },
592
- { latitude: 48.883872634050874, longitude: 2.368828249426273 },
593
- { latitude: 48.88406515070385, longitude: 2.368498640571453 },
594
- { latitude: 48.88415593345443, longitude: 2.367977988946442 },
595
- { latitude: 48.884366186588224, longitude: 2.364713572113417 },
596
- { latitude: 48.88440647786752, longitude: 2.358943445165456 },
597
- { latitude: 48.883724923006355, longitude: 2.34946498589375 },
598
- { latitude: 48.88348014130957, longitude: 2.349600316361947 },
599
- { latitude: 48.88064322368599, longitude: 2.349852552535392 },
600
- { latitude: 48.879103264973295, longitude: 2.349300461788451 },
601
- { latitude: 48.877528529751466, longitude: 2.349134703151032 },
602
- { latitude: 48.876082639873374, longitude: 2.348352431817903 },
603
- { latitude: 48.875483531082025, longitude: 2.348159503994068 },
604
- { latitude: 48.87401890252242, longitude: 2.347901065991873 },
605
- { latitude: 48.870687845194766, longitude: 2.347918228212595 },
606
- ],
607
- },
608
- {
609
- name: '75011',
610
- coordinates: [
611
- { latitude: 48.848098095643415, longitude: 2.39912112864224 },
612
- { latitude: 48.84887037371109, longitude: 2.399247133361469 },
613
- { latitude: 48.85121814099133, longitude: 2.398443279692394 },
614
- { latitude: 48.856519817264434, longitude: 2.394345091773725 },
615
- { latitude: 48.85762982783316, longitude: 2.392259137884479 },
616
- { latitude: 48.858488337142234, longitude: 2.38953680290813 },
617
- { latitude: 48.862960316687904, longitude: 2.387334803982951 },
618
- { latitude: 48.86626682231115, longitude: 2.383583978668194 },
619
- { latitude: 48.86717829087716, longitude: 2.382970657129259 },
620
- { latitude: 48.87077480734893, longitude: 2.378290113390532 },
621
- { latitude: 48.87204825945157, longitude: 2.376904765014237 },
622
- { latitude: 48.87072296605545, longitude: 2.373350142111482 },
623
- { latitude: 48.86948519613973, longitude: 2.369358394801618 },
624
- { latitude: 48.86881945661765, longitude: 2.36761059037576 },
625
- { latitude: 48.86823693070764, longitude: 2.365617798452501 },
626
- { latitude: 48.86751628680611, longitude: 2.363872116727158 },
627
- { latitude: 48.86730904970824, longitude: 2.364306784904801 },
628
- { latitude: 48.86616998447825, longitude: 2.364890494038093 },
629
- { latitude: 48.86307619289049, longitude: 2.366747947246461 },
630
- { latitude: 48.855805185784135, longitude: 2.368490886682737 },
631
- { latitude: 48.8531662305869, longitude: 2.369123881441927 },
632
- { latitude: 48.853281766619105, longitude: 2.370227747469653 },
633
- { latitude: 48.85238009863526, longitude: 2.372011671463846 },
634
- { latitude: 48.85162652960869, longitude: 2.374776331060795 },
635
- { latitude: 48.85062452055112, longitude: 2.378895746743247 },
636
- { latitude: 48.85045546819052, longitude: 2.380114712394509 },
637
- { latitude: 48.850408294808794, longitude: 2.381426253806176 },
638
- { latitude: 48.85012714200549, longitude: 2.38445763880411 },
639
- { latitude: 48.84837805392065, longitude: 2.395957776088525 },
640
- { latitude: 48.848098095643415, longitude: 2.39912112864224 },
641
- ],
642
- },
643
- {
644
- name: '75012',
645
- coordinates: [
646
- { latitude: 48.82622604799885, longitude: 2.465730572119004 },
647
- { latitude: 48.82732797148774, longitude: 2.466178324692476 },
648
- { latitude: 48.82766730212963, longitude: 2.465232235297585 },
649
- { latitude: 48.82762337988094, longitude: 2.464661941154306 },
650
- { latitude: 48.82835613324069, longitude: 2.464610827079944 },
651
- { latitude: 48.82927659148371, longitude: 2.464702177139618 },
652
- { latitude: 48.83034998496964, longitude: 2.465004468244835 },
653
- { latitude: 48.83131958522624, longitude: 2.465426352616533 },
654
- { latitude: 48.83186996614593, longitude: 2.465822578289197 },
655
- { latitude: 48.83252083864333, longitude: 2.466569253346513 },
656
- { latitude: 48.83350697416217, longitude: 2.468485472111639 },
657
- { latitude: 48.83379747097, longitude: 2.46889120610101 },
658
- { latitude: 48.834471077175294, longitude: 2.469496032469829 },
659
- { latitude: 48.83519517404729, longitude: 2.469724350790882 },
660
- { latitude: 48.836399076703366, longitude: 2.469851066867315 },
661
- { latitude: 48.836787659545045, longitude: 2.469661828529988 },
662
- { latitude: 48.83909938928418, longitude: 2.467319402317012 },
663
- { latitude: 48.84042258650739, longitude: 2.466164109594404 },
664
- { latitude: 48.8411739993649, longitude: 2.465258517101661 },
665
- { latitude: 48.84202339316052, longitude: 2.463741475493356 },
666
- { latitude: 48.8427305321657, longitude: 2.461793922353881 },
667
- { latitude: 48.84318144622756, longitude: 2.459873497765623 },
668
- { latitude: 48.84354999194321, longitude: 2.457843527623448 },
669
- { latitude: 48.844863220184784, longitude: 2.447852827419991 },
670
- { latitude: 48.84496757662449, longitude: 2.446497282929875 },
671
- { latitude: 48.845801966191466, longitude: 2.446646486889991 },
672
- { latitude: 48.84596434934236, longitude: 2.44075815339398 },
673
- { latitude: 48.84443973103078, longitude: 2.440519707011924 },
674
- { latitude: 48.84466425490433, longitude: 2.437958319623623 },
675
- { latitude: 48.84089321785074, longitude: 2.437184204443509 },
676
- { latitude: 48.84119770137154, longitude: 2.433669709036991 },
677
- { latitude: 48.84104601732137, longitude: 2.433544643445916 },
678
- { latitude: 48.84157070580793, longitude: 2.427575156761255 },
679
- { latitude: 48.841807990854, longitude: 2.424919695918368 },
680
- { latitude: 48.84195003388114, longitude: 2.424347225006843 },
681
- { latitude: 48.8421963345545, longitude: 2.42394800402987 },
682
- { latitude: 48.84265550727825, longitude: 2.423491922523838 },
683
- { latitude: 48.844057902638696, longitude: 2.422435387811296 },
684
- { latitude: 48.84443729120398, longitude: 2.421847988927574 },
685
- { latitude: 48.84345636332361, longitude: 2.419859968239216 },
686
- { latitude: 48.84310196352897, longitude: 2.419848924917878 },
687
- { latitude: 48.84257721169392, longitude: 2.419390134732614 },
688
- { latitude: 48.84232163628023, longitude: 2.419357555615491 },
689
- { latitude: 48.84144924086321, longitude: 2.419538952900591 },
690
- { latitude: 48.84043980851661, longitude: 2.420393582068758 },
691
- { latitude: 48.839329002819575, longitude: 2.420930485621125 },
692
- { latitude: 48.83675640610723, longitude: 2.421585771008497 },
693
- { latitude: 48.835797660968844, longitude: 2.422138636243514 },
694
- { latitude: 48.834188794977145, longitude: 2.417337888379133 },
695
- { latitude: 48.833863740527136, longitude: 2.41596829499726 },
696
- { latitude: 48.83371162706515, longitude: 2.413921063446628 },
697
- { latitude: 48.83377882853411, longitude: 2.412586590425243 },
698
- { latitude: 48.83392893878659, longitude: 2.411471874927622 },
699
- { latitude: 48.83453891468698, longitude: 2.41224561256264 },
700
- { latitude: 48.83621650677132, longitude: 2.412852033331908 },
701
- { latitude: 48.84499632197146, longitude: 2.415663673457239 },
702
- { latitude: 48.84662295629071, longitude: 2.415971110769569 },
703
- { latitude: 48.848098095643415, longitude: 2.39912112864224 },
704
- { latitude: 48.84837805392065, longitude: 2.395957776088525 },
705
- { latitude: 48.85012714200549, longitude: 2.38445763880411 },
706
- { latitude: 48.850408294808794, longitude: 2.381426253806176 },
707
- { latitude: 48.85045546819052, longitude: 2.380114712394509 },
708
- { latitude: 48.85062452055112, longitude: 2.378895746743247 },
709
- { latitude: 48.85162652960869, longitude: 2.374776331060795 },
710
- { latitude: 48.85238009863526, longitude: 2.372011671463846 },
711
- { latitude: 48.853281766619105, longitude: 2.370227747469653 },
712
- { latitude: 48.8531662305869, longitude: 2.369123881441927 },
713
- { latitude: 48.847309858182896, longitude: 2.366443514943608 },
714
- { latitude: 48.846185908499045, longitude: 2.364455435684601 },
715
- { latitude: 48.84496784315353, longitude: 2.36608772597324 },
716
- { latitude: 48.83932858921922, longitude: 2.373550475260092 },
717
- { latitude: 48.83760837651768, longitude: 2.37532187433978 },
718
- { latitude: 48.83502323089691, longitude: 2.378358228919764 },
719
- { latitude: 48.830310724138876, longitude: 2.384304749063456 },
720
- { latitude: 48.82674382243462, longitude: 2.388512315585048 },
721
- { latitude: 48.8256923268334, longitude: 2.390072014511326 },
722
- { latitude: 48.8275388425964, longitude: 2.394339872457588 },
723
- { latitude: 48.82772742957781, longitude: 2.395706662977831 },
724
- { latitude: 48.828626438945314, longitude: 2.399205253246101 },
725
- { latitude: 48.82958956721988, longitude: 2.402237349716066 },
726
- { latitude: 48.82917522224744, longitude: 2.40355118197321 },
727
- { latitude: 48.82844370168757, longitude: 2.404928550228594 },
728
- { latitude: 48.82635026937979, longitude: 2.407706677790519 },
729
- { latitude: 48.82550223158657, longitude: 2.409175132460024 },
730
- { latitude: 48.82513447821524, longitude: 2.410104166452181 },
731
- { latitude: 48.824897649004626, longitude: 2.411139313730769 },
732
- { latitude: 48.82474925652957, longitude: 2.412419992792227 },
733
- { latitude: 48.82478587221802, longitude: 2.415303127328633 },
734
- { latitude: 48.82473602165926, longitude: 2.416513222032046 },
735
- { latitude: 48.82408007225992, longitude: 2.419962519541093 },
736
- { latitude: 48.82405851819188, longitude: 2.421826072954111 },
737
- { latitude: 48.824190872609314, longitude: 2.424653634008315 },
738
- { latitude: 48.82412830976086, longitude: 2.426232966554127 },
739
- { latitude: 48.82390004189599, longitude: 2.427958492642779 },
740
- { latitude: 48.82343246086885, longitude: 2.42986096397427 },
741
- { latitude: 48.82315731077904, longitude: 2.430628080921096 },
742
- { latitude: 48.822877281284185, longitude: 2.430370989413491 },
743
- { latitude: 48.821619639807835, longitude: 2.432194835497048 },
744
- { latitude: 48.82190053174164, longitude: 2.432634430984659 },
745
- { latitude: 48.82169308983704, longitude: 2.432890021773652 },
746
- { latitude: 48.82142583088721, longitude: 2.432480242297731 },
747
- { latitude: 48.820158185702816, longitude: 2.434287751289356 },
748
- { latitude: 48.819215861619355, longitude: 2.434144075250626 },
749
- { latitude: 48.819669132169594, longitude: 2.434901851098009 },
750
- { latitude: 48.81959260434536, longitude: 2.436027653556642 },
751
- { latitude: 48.81936479454812, longitude: 2.43692491658807 },
752
- { latitude: 48.81911090908929, longitude: 2.437442471570391 },
753
- { latitude: 48.81817682287283, longitude: 2.437328614686424 },
754
- { latitude: 48.8182912075758, longitude: 2.439853739221728 },
755
- { latitude: 48.817904339357014, longitude: 2.442325672531203 },
756
- { latitude: 48.81787520405805, longitude: 2.44418090156304 },
757
- { latitude: 48.817965657938686, longitude: 2.447786272701002 },
758
- { latitude: 48.81790844861154, longitude: 2.44942252921523 },
759
- { latitude: 48.81772864411715, longitude: 2.450806758669985 },
760
- { latitude: 48.817148977574625, longitude: 2.453452200812278 },
761
- { latitude: 48.81703442399674, longitude: 2.458717081488418 },
762
- { latitude: 48.816996671392914, longitude: 2.459119228635604 },
763
- { latitude: 48.81736539731129, longitude: 2.459115403967742 },
764
- { latitude: 48.818355149167424, longitude: 2.461205214252256 },
765
- { latitude: 48.81905977057768, longitude: 2.462696062752353 },
766
- { latitude: 48.82017755814534, longitude: 2.462867047647515 },
767
- { latitude: 48.82408428543058, longitude: 2.465044244672474 },
768
- { latitude: 48.82622604799885, longitude: 2.465730572119004 },
769
- ],
770
- },
771
- {
772
- name: '75013',
773
- coordinates: [
774
- { latitude: 48.8256923268334, longitude: 2.390072014511326 },
775
- { latitude: 48.82674382243462, longitude: 2.388512315585048 },
776
- { latitude: 48.830310724138876, longitude: 2.384304749063456 },
777
- { latitude: 48.83502323089691, longitude: 2.378358228919764 },
778
- { latitude: 48.83760837651768, longitude: 2.37532187433978 },
779
- { latitude: 48.83932858921922, longitude: 2.373550475260092 },
780
- { latitude: 48.84496784315353, longitude: 2.36608772597324 },
781
- { latitude: 48.84441324001663, longitude: 2.365127018289573 },
782
- { latitude: 48.83994070616588, longitude: 2.361745287380767 },
783
- { latitude: 48.83680458564547, longitude: 2.351870772035156 },
784
- { latitude: 48.8373159561145, longitude: 2.347007359776023 },
785
- { latitude: 48.83834304474304, longitude: 2.3420855672544 },
786
- { latitude: 48.831971728566735, longitude: 2.341072060968536 },
787
- { latitude: 48.83158867633762, longitude: 2.341249912243379 },
788
- { latitude: 48.829424470731965, longitude: 2.341356268572921 },
789
- { latitude: 48.82835285908605, longitude: 2.341600018072803 },
790
- { latitude: 48.8264902090798, longitude: 2.341592211729773 },
791
- { latitude: 48.826448159169985, longitude: 2.341795702304384 },
792
- { latitude: 48.82376077246724, longitude: 2.341460506665151 },
793
- { latitude: 48.82253047839436, longitude: 2.341797487786054 },
794
- { latitude: 48.8214693952813, longitude: 2.342485079713176 },
795
- { latitude: 48.8205031036122, longitude: 2.34372986496089 },
796
- { latitude: 48.819564378724635, longitude: 2.344591545649815 },
797
- { latitude: 48.817772072702724, longitude: 2.344129230885391 },
798
- { latitude: 48.81576700131055, longitude: 2.343902504744146 },
799
- { latitude: 48.81556223808136, longitude: 2.344448463099662 },
800
- { latitude: 48.816015918171495, longitude: 2.344355599882104 },
801
- { latitude: 48.81609244607704, longitude: 2.345190828033564 },
802
- { latitude: 48.815986514627156, longitude: 2.346541772031784 },
803
- { latitude: 48.816046794225414, longitude: 2.347039461823859 },
804
- { latitude: 48.81796203704577, longitude: 2.351253779116589 },
805
- { latitude: 48.818551005944926, longitude: 2.352391840207208 },
806
- { latitude: 48.815922815506724, longitude: 2.355852301315165 },
807
- { latitude: 48.8159428482679, longitude: 2.35623201503909 },
808
- { latitude: 48.816148134601306, longitude: 2.363328923996346 },
809
- { latitude: 48.81639832400939, longitude: 2.36420428117288 },
810
- { latitude: 48.82170074781111, longitude: 2.380767116748347 },
811
- { latitude: 48.82241067607562, longitude: 2.381524148119776 },
812
- { latitude: 48.82372935998316, longitude: 2.385225588159262 },
813
- { latitude: 48.82446306389831, longitude: 2.386941338175521 },
814
- { latitude: 48.825344669637964, longitude: 2.389445425188181 },
815
- { latitude: 48.8256923268334, longitude: 2.390072014511326 },
816
- ],
817
- },
818
- {
819
- name: '75014',
820
- coordinates: [
821
- { latitude: 48.81576700131055, longitude: 2.343902504744146 },
822
- { latitude: 48.817772072702724, longitude: 2.344129230885391 },
823
- { latitude: 48.819564378724635, longitude: 2.344591545649815 },
824
- { latitude: 48.8205031036122, longitude: 2.34372986496089 },
825
- { latitude: 48.8214693952813, longitude: 2.342485079713176 },
826
- { latitude: 48.82253047839436, longitude: 2.341797487786054 },
827
- { latitude: 48.82376077246724, longitude: 2.341460506665151 },
828
- { latitude: 48.826448159169985, longitude: 2.341795702304384 },
829
- { latitude: 48.8264902090798, longitude: 2.341592211729773 },
830
- { latitude: 48.82835285908605, longitude: 2.341600018072803 },
831
- { latitude: 48.829424470731965, longitude: 2.341356268572921 },
832
- { latitude: 48.83158867633762, longitude: 2.341249912243379 },
833
- { latitude: 48.831971728566735, longitude: 2.341072060968536 },
834
- { latitude: 48.83834304474304, longitude: 2.3420855672544 },
835
- { latitude: 48.838863210249016, longitude: 2.33969740550839 },
836
- { latitude: 48.83967110759586, longitude: 2.336656991547953 },
837
- { latitude: 48.84362134269369, longitude: 2.324641767064502 },
838
- { latitude: 48.841083720001784, longitude: 2.321531293255953 },
839
- { latitude: 48.84096466462326, longitude: 2.321471529354067 },
840
- { latitude: 48.840098848173, longitude: 2.321837052015564 },
841
- { latitude: 48.83977706203551, longitude: 2.321394340274795 },
842
- { latitude: 48.84053920528781, longitude: 2.319877474643327 },
843
- { latitude: 48.83630315390716, longitude: 2.31483053793085 },
844
- { latitude: 48.834024151743044, longitude: 2.311855157087501 },
845
- { latitude: 48.830178156237864, longitude: 2.307135337599138 },
846
- { latitude: 48.829822621456245, longitude: 2.306931640548025 },
847
- { latitude: 48.82512576085532, longitude: 2.301315418488453 },
848
- { latitude: 48.82229053545533, longitude: 2.314145699672971 },
849
- { latitude: 48.81824713009672, longitude: 2.332461042459755 },
850
- { latitude: 48.81701092965555, longitude: 2.331898060637625 },
851
- { latitude: 48.81677101758198, longitude: 2.333711090278114 },
852
- { latitude: 48.81633041156168, longitude: 2.341683722695743 },
853
- { latitude: 48.81608499759873, longitude: 2.343013285918382 },
854
- { latitude: 48.81576700131055, longitude: 2.343902504744146 },
855
- ],
856
- },
857
- {
858
- name: '75015',
859
- coordinates: [
860
- { latitude: 48.82833384159797, longitude: 2.289407656009722 },
861
- { latitude: 48.82714158494903, longitude: 2.292191836480193 },
862
- { latitude: 48.82512576085532, longitude: 2.301315418488453 },
863
- { latitude: 48.829822621456245, longitude: 2.306931640548025 },
864
- { latitude: 48.830178156237864, longitude: 2.307135337599138 },
865
- { latitude: 48.834024151743044, longitude: 2.311855157087501 },
866
- { latitude: 48.83630315390716, longitude: 2.31483053793085 },
867
- { latitude: 48.84053920528781, longitude: 2.319877474643327 },
868
- { latitude: 48.83977706203551, longitude: 2.321394340274795 },
869
- { latitude: 48.840098848173, longitude: 2.321837052015564 },
870
- { latitude: 48.84096466462326, longitude: 2.321471529354067 },
871
- { latitude: 48.841083720001784, longitude: 2.321531293255953 },
872
- { latitude: 48.84362134269369, longitude: 2.324641767064502 },
873
- { latitude: 48.84516563132351, longitude: 2.319893405967863 },
874
- { latitude: 48.84663569580366, longitude: 2.31698262350471 },
875
- { latitude: 48.8468634910953, longitude: 2.316712552321029 },
876
- { latitude: 48.84594337806365, longitude: 2.313715867497841 },
877
- { latitude: 48.84797630479076, longitude: 2.310494899377193 },
878
- { latitude: 48.847433437634464, longitude: 2.308218200598362 },
879
- { latitude: 48.84713344729916, longitude: 2.307354149221546 },
880
- { latitude: 48.8510622115364, longitude: 2.301227956943836 },
881
- { latitude: 48.85138469655275, longitude: 2.3005463196733 },
882
- { latitude: 48.857475043730936, longitude: 2.291053303527222 },
883
- { latitude: 48.85818288040792, longitude: 2.289695682973308 },
884
- { latitude: 48.85702108344801, longitude: 2.288513487011697 },
885
- { latitude: 48.85613429105026, longitude: 2.288206671073602 },
886
- { latitude: 48.85576425362537, longitude: 2.28783692345414 },
887
- { latitude: 48.84888826708062, longitude: 2.278021048066484 },
888
- { latitude: 48.84724764765358, longitude: 2.276056963888965 },
889
- { latitude: 48.8368383991733, longitude: 2.26603238468276 },
890
- { latitude: 48.83392337353757, longitude: 2.262791524526515 },
891
- { latitude: 48.834592508407525, longitude: 2.267475422198173 },
892
- { latitude: 48.83442815872476, longitude: 2.268101694609093 },
893
- { latitude: 48.83301112513089, longitude: 2.269930760703455 },
894
- { latitude: 48.831531984417225, longitude: 2.267338606820312 },
895
- { latitude: 48.82796859562667, longitude: 2.267625707632298 },
896
- { latitude: 48.827835816786674, longitude: 2.267826452957426 },
897
- { latitude: 48.82792008423927, longitude: 2.272793190186762 },
898
- { latitude: 48.82943549605779, longitude: 2.275304441773053 },
899
- { latitude: 48.832489952159186, longitude: 2.279051930653325 },
900
- { latitude: 48.83079578621541, longitude: 2.28358582721177 },
901
- { latitude: 48.82833384159797, longitude: 2.289407656009722 },
902
- ],
903
- },
904
- {
905
- name: '75016',
906
- coordinates: [
907
- { latitude: 48.859404562409956, longitude: 2.22567029225698 },
908
- { latitude: 48.85615417947494, longitude: 2.224407449942075 },
909
- { latitude: 48.853516917570474, longitude: 2.224219105880448 },
910
- { latitude: 48.8528118999558, longitude: 2.22659415034592 },
911
- { latitude: 48.85004249476624, longitude: 2.239179626559884 },
912
- { latitude: 48.84983219823168, longitude: 2.239770051491471 },
913
- { latitude: 48.84957131323047, longitude: 2.240184049668479 },
914
- { latitude: 48.84765777953375, longitude: 2.242362313011173 },
915
- { latitude: 48.84555514449767, longitude: 2.25051568878781 },
916
- { latitude: 48.845485576383105, longitude: 2.252477551164905 },
917
- { latitude: 48.84289019705539, longitude: 2.25121623048677 },
918
- { latitude: 48.83882181624815, longitude: 2.251709308946857 },
919
- { latitude: 48.83480954938314, longitude: 2.255144238417506 },
920
- { latitude: 48.83392337353757, longitude: 2.262791524526515 },
921
- { latitude: 48.8368383991733, longitude: 2.26603238468276 },
922
- { latitude: 48.84724764765358, longitude: 2.276056963888965 },
923
- { latitude: 48.84888826708062, longitude: 2.278021048066484 },
924
- { latitude: 48.85576425362537, longitude: 2.28783692345414 },
925
- { latitude: 48.85613429105026, longitude: 2.288206671073602 },
926
- { latitude: 48.85702108344801, longitude: 2.288513487011697 },
927
- { latitude: 48.85818288040792, longitude: 2.289695682973308 },
928
- { latitude: 48.860253620211, longitude: 2.292195882851742 },
929
- { latitude: 48.861246340432466, longitude: 2.293689941916094 },
930
- { latitude: 48.861875619399484, longitude: 2.294864562062728 },
931
- { latitude: 48.86261949443383, longitude: 2.296870514172013 },
932
- { latitude: 48.863144008401505, longitude: 2.298589132813498 },
933
- { latitude: 48.86328352059519, longitude: 2.299222465550165 },
934
- { latitude: 48.863496076964175, longitude: 2.301737287583634 },
935
- { latitude: 48.86449106268491, longitude: 2.301635346720621 },
936
- { latitude: 48.8650075721619, longitude: 2.300297979606478 },
937
- { latitude: 48.864986916136104, longitude: 2.299841599006072 },
938
- { latitude: 48.86553729851455, longitude: 2.29983829121079 },
939
- { latitude: 48.868644254049464, longitude: 2.298866790658252 },
940
- { latitude: 48.87093857212867, longitude: 2.297501223263733 },
941
- { latitude: 48.87330312962187, longitude: 2.295542880656993 },
942
- { latitude: 48.87377317675925, longitude: 2.295032069299387 },
943
- { latitude: 48.87857312399539, longitude: 2.279949332567545 },
944
- { latitude: 48.878531568022304, longitude: 2.279469949480847 },
945
- { latitude: 48.87796832086615, longitude: 2.277487029813821 },
946
- { latitude: 48.88038726309937, longitude: 2.258467171114177 },
947
- { latitude: 48.874263542689825, longitude: 2.255410336689475 },
948
- { latitude: 48.87408088138245, longitude: 2.254817140668558 },
949
- { latitude: 48.8761415911801, longitude: 2.24653328131267 },
950
- { latitude: 48.87645923248996, longitude: 2.245703788405577 },
951
- { latitude: 48.87378465913534, longitude: 2.243010273208006 },
952
- { latitude: 48.8729013887102, longitude: 2.241856061513683 },
953
- { latitude: 48.87234161752639, longitude: 2.240945304504729 },
954
- { latitude: 48.87157344357182, longitude: 2.239225056762461 },
955
- { latitude: 48.8705231346677, longitude: 2.235575811057111 },
956
- { latitude: 48.8698977965053, longitude: 2.233702274504687 },
957
- { latitude: 48.8690685816238, longitude: 2.23173635974686 },
958
- { latitude: 48.868079566940466, longitude: 2.230658982743393 },
959
- { latitude: 48.86538030260198, longitude: 2.228377351113232 },
960
- { latitude: 48.862384917783594, longitude: 2.227181294011469 },
961
- { latitude: 48.859404562409956, longitude: 2.22567029225698 },
962
- ],
963
- },
964
- {
965
- name: '75017',
966
- coordinates: [
967
- { latitude: 48.900459782103866, longitude: 2.319887174744136 },
968
- { latitude: 48.89963812815515, longitude: 2.318520205834404 },
969
- { latitude: 48.897782317992146, longitude: 2.312451445254303 },
970
- { latitude: 48.8960101863785, longitude: 2.307687317214232 },
971
- { latitude: 48.89415377896271, longitude: 2.303774362351613 },
972
- { latitude: 48.89171715165069, longitude: 2.298628375977243 },
973
- { latitude: 48.88987478127485, longitude: 2.295013183223064 },
974
- { latitude: 48.889455535247485, longitude: 2.291633908192159 },
975
- { latitude: 48.88930157078857, longitude: 2.291147763745907 },
976
- { latitude: 48.8865546635736, longitude: 2.28564161638002 },
977
- { latitude: 48.885639278215145, longitude: 2.284459571754662 },
978
- { latitude: 48.88557409668247, longitude: 2.284538198303594 },
979
- { latitude: 48.8829709900862, longitude: 2.28101351971156 },
980
- { latitude: 48.88279222371682, longitude: 2.280897352279333 },
981
- { latitude: 48.87857312399539, longitude: 2.279949332567545 },
982
- { latitude: 48.87377317675925, longitude: 2.295032069299387 },
983
- { latitude: 48.87807688568086, longitude: 2.29815486307795 },
984
- { latitude: 48.88043436140222, longitude: 2.308874779443685 },
985
- { latitude: 48.88134138388508, longitude: 2.316479725210514 },
986
- { latitude: 48.88345508679081, longitude: 2.327164725373034 },
987
- { latitude: 48.88350780062572, longitude: 2.327423135703935 },
988
- { latitude: 48.88750763509561, longitude: 2.325595877207139 },
989
- { latitude: 48.90104370553223, longitude: 2.330147116964155 },
990
- { latitude: 48.900775849620445, longitude: 2.320434138736962 },
991
- { latitude: 48.900459782103866, longitude: 2.319887174744136 },
992
- ],
993
- },
994
- {
995
- name: '75018',
996
- coordinates: [
997
- { latitude: 48.90104370553223, longitude: 2.330147116964155 },
998
- { latitude: 48.88750763509561, longitude: 2.325595877207139 },
999
- { latitude: 48.88350780062572, longitude: 2.327423135703935 },
1000
- { latitude: 48.88370687653772, longitude: 2.328121477639862 },
1001
- { latitude: 48.88458988070801, longitude: 2.329540571639999 },
1002
- { latitude: 48.883825698481346, longitude: 2.332482251093436 },
1003
- { latitude: 48.882386207496275, longitude: 2.337400148117986 },
1004
- { latitude: 48.88202355548529, longitude: 2.33980196854301 },
1005
- { latitude: 48.88341423078806, longitude: 2.346909326916857 },
1006
- { latitude: 48.883724923006355, longitude: 2.34946498589375 },
1007
- { latitude: 48.88440647786752, longitude: 2.358943445165456 },
1008
- { latitude: 48.884366186588224, longitude: 2.364713572113417 },
1009
- { latitude: 48.88664424349012, longitude: 2.366762718491148 },
1010
- { latitude: 48.88862427851229, longitude: 2.36756099045785 },
1011
- { latitude: 48.891028986832545, longitude: 2.368738771328434 },
1012
- { latitude: 48.89400536979352, longitude: 2.370035221900148 },
1013
- { latitude: 48.894703718756226, longitude: 2.370639174782484 },
1014
- { latitude: 48.89539325119283, longitude: 2.371791555807095 },
1015
- { latitude: 48.89579788926028, longitude: 2.371267006547412 },
1016
- { latitude: 48.89599436181304, longitude: 2.371175976445193 },
1017
- { latitude: 48.89665858510903, longitude: 2.370420494086907 },
1018
- { latitude: 48.89991143474197, longitude: 2.37025429708778 },
1019
- { latitude: 48.90094336965187, longitude: 2.370334571644305 },
1020
- { latitude: 48.90155583737034, longitude: 2.370170291188828 },
1021
- { latitude: 48.90184790618994, longitude: 2.370301804653317 },
1022
- { latitude: 48.90175754961884, longitude: 2.365619903608482 },
1023
- { latitude: 48.90148489872572, longitude: 2.35198353616043 },
1024
- { latitude: 48.90104370553223, longitude: 2.330147116964155 },
1025
- ],
1026
- },
1027
- {
1028
- name: '75019',
1029
- coordinates: [
1030
- { latitude: 48.901161349328916, longitude: 2.389332400904481 },
1031
- { latitude: 48.90214759336665, longitude: 2.384530045616338 },
1032
- { latitude: 48.90184790618994, longitude: 2.370301804653317 },
1033
- { latitude: 48.90155583737034, longitude: 2.370170291188828 },
1034
- { latitude: 48.90094336965187, longitude: 2.370334571644305 },
1035
- { latitude: 48.89991143474197, longitude: 2.37025429708778 },
1036
- { latitude: 48.89665858510903, longitude: 2.370420494086907 },
1037
- { latitude: 48.89599436181304, longitude: 2.371175976445193 },
1038
- { latitude: 48.89579788926028, longitude: 2.371267006547412 },
1039
- { latitude: 48.89539325119283, longitude: 2.371791555807095 },
1040
- { latitude: 48.894703718756226, longitude: 2.370639174782484 },
1041
- { latitude: 48.89400536979352, longitude: 2.370035221900148 },
1042
- { latitude: 48.891028986832545, longitude: 2.368738771328434 },
1043
- { latitude: 48.88862427851229, longitude: 2.36756099045785 },
1044
- { latitude: 48.88664424349012, longitude: 2.366762718491148 },
1045
- { latitude: 48.884366186588224, longitude: 2.364713572113417 },
1046
- { latitude: 48.88415593345443, longitude: 2.367977988946442 },
1047
- { latitude: 48.88406515070385, longitude: 2.368498640571453 },
1048
- { latitude: 48.883872634050874, longitude: 2.368828249426273 },
1049
- { latitude: 48.88331304763526, longitude: 2.369301392563939 },
1050
- { latitude: 48.88284025325768, longitude: 2.370032562091205 },
1051
- { latitude: 48.882467160769735, longitude: 2.37022798018227 },
1052
- { latitude: 48.87799062237773, longitude: 2.370290292159464 },
1053
- { latitude: 48.87204825945157, longitude: 2.376904765014237 },
1054
- { latitude: 48.87230118280218, longitude: 2.377636578896359 },
1055
- { latitude: 48.872855789129034, longitude: 2.37983449373543 },
1056
- { latitude: 48.87341004977963, longitude: 2.382670514713277 },
1057
- { latitude: 48.873755493311755, longitude: 2.384960981845434 },
1058
- { latitude: 48.87460137709541, longitude: 2.386813394433955 },
1059
- { latitude: 48.87476467291205, longitude: 2.388496636417808 },
1060
- { latitude: 48.87530293935915, longitude: 2.389645129763283 },
1061
- { latitude: 48.87543928049738, longitude: 2.39045749316421 },
1062
- { latitude: 48.87546284659465, longitude: 2.392262384706681 },
1063
- { latitude: 48.875247751886285, longitude: 2.395250770064706 },
1064
- { latitude: 48.8754912960971, longitude: 2.398965987022433 },
1065
- { latitude: 48.8759957893625, longitude: 2.402552808956574 },
1066
- { latitude: 48.877055178904335, longitude: 2.406163368113694 },
1067
- { latitude: 48.877182706305746, longitude: 2.406853189526919 },
1068
- { latitude: 48.878206930961, longitude: 2.409924373433166 },
1069
- { latitude: 48.87843617582368, longitude: 2.410820319151064 },
1070
- { latitude: 48.8802555133981, longitude: 2.409359835767223 },
1071
- { latitude: 48.88126873962876, longitude: 2.40457585141299 },
1072
- { latitude: 48.88263120606274, longitude: 2.401507160545184 },
1073
- { latitude: 48.88382119876317, longitude: 2.400106665255306 },
1074
- { latitude: 48.885361950398725, longitude: 2.399251617609397 },
1075
- { latitude: 48.888532380125696, longitude: 2.399135941386648 },
1076
- { latitude: 48.88953234877588, longitude: 2.398941654577955 },
1077
- { latitude: 48.89264044860453, longitude: 2.398236114786815 },
1078
- { latitude: 48.89460619615223, longitude: 2.397667826349163 },
1079
- { latitude: 48.898169708064955, longitude: 2.395610584956599 },
1080
- { latitude: 48.90090731297284, longitude: 2.390837239618765 },
1081
- { latitude: 48.901161349328916, longitude: 2.389332400904481 },
1082
- ],
1083
- },
1084
- {
1085
- name: '75020',
1086
- coordinates: [
1087
- { latitude: 48.85517782834211, longitude: 2.415286455935683 },
1088
- { latitude: 48.86064945777895, longitude: 2.414370428780847 },
1089
- { latitude: 48.864712425928325, longitude: 2.413951255837119 },
1090
- { latitude: 48.86954537097517, longitude: 2.413932326856992 },
1091
- { latitude: 48.872438026487984, longitude: 2.413646198880089 },
1092
- { latitude: 48.87314025051987, longitude: 2.413431063629795 },
1093
- { latitude: 48.87644319371046, longitude: 2.412453090020587 },
1094
- { latitude: 48.87843617582368, longitude: 2.410820319151064 },
1095
- { latitude: 48.878206930961, longitude: 2.409924373433166 },
1096
- { latitude: 48.877182706305746, longitude: 2.406853189526919 },
1097
- { latitude: 48.877055178904335, longitude: 2.406163368113694 },
1098
- { latitude: 48.8759957893625, longitude: 2.402552808956574 },
1099
- { latitude: 48.8754912960971, longitude: 2.398965987022433 },
1100
- { latitude: 48.875247751886285, longitude: 2.395250770064706 },
1101
- { latitude: 48.87546284659465, longitude: 2.392262384706681 },
1102
- { latitude: 48.87543928049738, longitude: 2.39045749316421 },
1103
- { latitude: 48.87530293935915, longitude: 2.389645129763283 },
1104
- { latitude: 48.87476467291205, longitude: 2.388496636417808 },
1105
- { latitude: 48.87460137709541, longitude: 2.386813394433955 },
1106
- { latitude: 48.873755493311755, longitude: 2.384960981845434 },
1107
- { latitude: 48.87341004977963, longitude: 2.382670514713277 },
1108
- { latitude: 48.872855789129034, longitude: 2.37983449373543 },
1109
- { latitude: 48.87230118280218, longitude: 2.377636578896359 },
1110
- { latitude: 48.87204825945157, longitude: 2.376904765014237 },
1111
- { latitude: 48.87077480734893, longitude: 2.378290113390532 },
1112
- { latitude: 48.86717829087716, longitude: 2.382970657129259 },
1113
- { latitude: 48.86626682231115, longitude: 2.383583978668194 },
1114
- { latitude: 48.862960316687904, longitude: 2.387334803982951 },
1115
- { latitude: 48.858488337142234, longitude: 2.38953680290813 },
1116
- { latitude: 48.85762982783316, longitude: 2.392259137884479 },
1117
- { latitude: 48.856519817264434, longitude: 2.394345091773725 },
1118
- { latitude: 48.85121814099133, longitude: 2.398443279692394 },
1119
- { latitude: 48.84887037371109, longitude: 2.399247133361469 },
1120
- { latitude: 48.848098095643415, longitude: 2.39912112864224 },
1121
- { latitude: 48.84662295629071, longitude: 2.415971110769569 },
1122
- { latitude: 48.848699611169536, longitude: 2.416349838517879 },
1123
- { latitude: 48.84923378356546, longitude: 2.416341130298895 },
1124
- { latitude: 48.85517782834211, longitude: 2.415286455935683 },
1125
- ],
1126
- },
1127
- ];
1128
-
1129
- const formatData = (geoResults) => {
1130
- const getOutline = (city, zipcode) => {
1131
- if (!geoResults || geoResults.length === 0)
283
+ if (typeof searchValue !== 'string') {
1132
284
  return [];
1133
- if (city === 'Paris') {
1134
- const outline = parisOutline.find(outline => outline.name === zipcode);
1135
- if (outline) {
1136
- return outline.coordinates;
1137
- }
1138
285
  }
1139
- return [];
1140
- };
1141
- return geoResults.map(result => {
1142
- const customOutline = getOutline(result.nom, result.codesPostaux[0]);
1143
- let outline = [];
1144
- if (customOutline.length > 0) {
1145
- outline = [customOutline];
1146
- }
1147
- else if (result.contour.type === 'Polygon') {
1148
- outline = [result.contour.coordinates[0].map(([longitude, latitude]) => ({ longitude, latitude }))];
286
+ if (isNaN(parseInt(searchValue)) && searchType.includes('city')) {
287
+ const result = yield searchByMunicipality(searchValue, options);
288
+ return result;
1149
289
  }
1150
- else if (result.contour.type === 'MultiPolygon') {
1151
- outline = result.contour.coordinates.map(([coordinates]) => coordinates.map(([longitude, latitude]) => ({ longitude, latitude })));
290
+ if (!isNaN(parseInt(searchValue)) && searchValue.length === 5 && searchType.includes('zipcode')) {
291
+ const result = yield searchByZipcode(searchValue, options);
292
+ return result;
1152
293
  }
1153
- return {
1154
- center: { latitude: result.centre.coordinates[1], longitude: result.centre.coordinates[0] },
1155
- city: result.nom,
1156
- code: result.code,
1157
- coordinates: result.centre.coordinates,
1158
- zipcode: result.codesPostaux[0],
1159
- outline,
1160
- };
1161
- });
1162
- };
1163
- const getData = (search, signal) => __awaiter(void 0, void 0, void 0, function* () {
1164
- try {
1165
- let geoResults = [];
1166
- const geoResponse = yield fetch(`https://geo.api.gouv.fr/communes?lat=${search.latitude}&lon=${search.longitude}&type=arrondissement-municipal&fields=departement,codesPostaux,centre,contour`, { signal });
1167
- if (!geoResponse.ok)
1168
- return Promise.reject(geoResponse);
1169
- geoResults = yield geoResponse.json();
1170
- if (geoResults.length === 0) {
1171
- const geoResponse = yield fetch(`https://geo.api.gouv.fr/communes?lat=${search.latitude}&lon=${search.longitude}&fields=departement,codesPostaux,centre,contour`, { signal });
1172
- if (!geoResponse.ok)
1173
- return Promise.reject(geoResponse);
1174
- geoResults = yield geoResponse.json();
1175
- }
1176
- return formatData(geoResults);
294
+ return [];
1177
295
  }
1178
296
  catch (error) {
1179
- if (typeof error === 'string')
1180
- throw new Error(error);
1181
- throw new Error(error instanceof Error && error.message ? error.message : 'An error occurred.');
297
+ console.log('An error occurred while searching for places');
298
+ console.log(error);
299
+ return [];
1182
300
  }
1183
301
  });
1184
- let getDelayedData;
1185
- const get = (search, debounceValue = 300, signal) => {
1186
- clearTimeout(getDelayedData);
1187
- return new Promise((resolve, reject) => {
1188
- getDelayedData = setTimeout(() => {
1189
- resolve(getData(search, signal));
1190
- }, debounceValue);
1191
- });
1192
- };
1193
-
1194
- var reverseGeolocSearch = /*#__PURE__*/Object.freeze({
1195
- __proto__: null,
1196
- get: get
1197
- });
302
+ const searchDepartment = (searchValue, options) => searchByDepartment(searchValue, options);
303
+ const searchAddress = (searchValue, options) => searchByAddress(searchValue, options);
304
+ /* Deprecated names */
305
+ /**
306
+ * @deprecated Use searchPlaces instead
307
+ */
308
+ const municipalitySearch = searchPlaces;
309
+ /**
310
+ * @deprecated Use searchPlaces instead
311
+ */
312
+ const geolocSearch = searchPlaces;
313
+ /**
314
+ * @deprecated Use searchByCoordinates instead
315
+ */
316
+ const reverseGeolocSearch = searchByCoordinates;
317
+ /**
318
+ * @deprecated Use searchAddress instead
319
+ */
320
+ const addressSearch = searchByAddress;
1198
321
 
1199
322
  exports.addressSearch = addressSearch;
1200
- exports.countrySearch = countrySearch;
1201
323
  exports.geolocSearch = geolocSearch;
1202
324
  exports.municipalitySearch = municipalitySearch;
1203
325
  exports.reverseGeolocSearch = reverseGeolocSearch;
326
+ exports.searchAddress = searchAddress;
327
+ exports.searchCountry = searchByCountry;
328
+ exports.searchDepartment = searchDepartment;
329
+ exports.searchPlaces = searchPlaces;