@esri/arcgis-rest-geocoding 3.4.3 → 4.0.0-beta.4

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.
Files changed (52) hide show
  1. package/README.md +13 -14
  2. package/dist/bundled/geocoding.esm.js +530 -0
  3. package/dist/bundled/geocoding.esm.js.map +1 -0
  4. package/dist/bundled/geocoding.esm.min.js +12 -0
  5. package/dist/bundled/geocoding.esm.min.js.map +1 -0
  6. package/dist/bundled/geocoding.umd.js +544 -0
  7. package/dist/bundled/geocoding.umd.js.map +1 -0
  8. package/dist/bundled/geocoding.umd.min.js +13 -0
  9. package/dist/bundled/geocoding.umd.min.js.map +1 -0
  10. package/dist/{node → cjs}/bulk.js +12 -12
  11. package/dist/cjs/bulk.js.map +1 -0
  12. package/dist/{node → cjs}/geocode.js +22 -21
  13. package/dist/cjs/geocode.js.map +1 -0
  14. package/dist/{node → cjs}/helpers.js +4 -5
  15. package/dist/cjs/helpers.js.map +1 -0
  16. package/dist/cjs/index.js +11 -0
  17. package/dist/cjs/index.js.map +1 -0
  18. package/dist/cjs/package.json +3 -0
  19. package/dist/{node → cjs}/reverse.js +7 -7
  20. package/dist/cjs/reverse.js.map +1 -0
  21. package/dist/{node → cjs}/suggest.js +7 -7
  22. package/dist/cjs/suggest.js.map +1 -0
  23. package/dist/esm/bulk.d.ts +7 -6
  24. package/dist/esm/bulk.js +10 -10
  25. package/dist/esm/bulk.js.map +1 -1
  26. package/dist/esm/geocode.d.ts +10 -6
  27. package/dist/esm/geocode.js +16 -15
  28. package/dist/esm/geocode.js.map +1 -1
  29. package/dist/esm/helpers.js +4 -5
  30. package/dist/esm/helpers.js.map +1 -1
  31. package/dist/esm/index.d.ts +6 -6
  32. package/dist/esm/index.js +5 -5
  33. package/dist/esm/index.js.map +1 -1
  34. package/dist/esm/package.json +3 -0
  35. package/dist/esm/reverse.d.ts +4 -3
  36. package/dist/esm/reverse.js +6 -6
  37. package/dist/esm/reverse.js.map +1 -1
  38. package/dist/esm/suggest.d.ts +3 -2
  39. package/dist/esm/suggest.js +6 -6
  40. package/dist/esm/suggest.js.map +1 -1
  41. package/package.json +56 -42
  42. package/dist/node/bulk.js.map +0 -1
  43. package/dist/node/geocode.js.map +0 -1
  44. package/dist/node/helpers.js.map +0 -1
  45. package/dist/node/index.js +0 -11
  46. package/dist/node/index.js.map +0 -1
  47. package/dist/node/reverse.js.map +0 -1
  48. package/dist/node/suggest.js.map +0 -1
  49. package/dist/umd/geocoding.umd.js +0 -565
  50. package/dist/umd/geocoding.umd.js.map +0 -1
  51. package/dist/umd/geocoding.umd.min.js +0 -12
  52. package/dist/umd/geocoding.umd.min.js.map +0 -1
@@ -1,565 +0,0 @@
1
- /* @preserve
2
- * @esri/arcgis-rest-geocoding - v3.4.3 - Apache-2.0
3
- * Copyright (c) 2017-2021 Esri, Inc.
4
- * Fri Oct 29 2021 14:49:24 GMT-0600 (Mountain Daylight Time)
5
- */
6
- (function (global, factory) {
7
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@esri/arcgis-rest-request')) :
8
- typeof define === 'function' && define.amd ? define(['exports', '@esri/arcgis-rest-request'], factory) :
9
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.arcgisRest = global.arcgisRest || {}, global.arcgisRest));
10
- }(this, (function (exports, arcgisRestRequest) { 'use strict';
11
-
12
- /*! *****************************************************************************
13
- Copyright (c) Microsoft Corporation.
14
-
15
- Permission to use, copy, modify, and/or distribute this software for any
16
- purpose with or without fee is hereby granted.
17
-
18
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
19
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
20
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
21
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
22
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
23
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
24
- PERFORMANCE OF THIS SOFTWARE.
25
- ***************************************************************************** */
26
-
27
- var __assign = function() {
28
- __assign = Object.assign || function __assign(t) {
29
- for (var s, i = 1, n = arguments.length; i < n; i++) {
30
- s = arguments[i];
31
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
32
- }
33
- return t;
34
- };
35
- return __assign.apply(this, arguments);
36
- };
37
-
38
- /* Copyright (c) 2017 Environmental Systems Research Institute, Inc.
39
- * Apache-2.0 */
40
- // https always
41
- var ARCGIS_ONLINE_GEOCODING_URL = "https://geocode-api.arcgis.com/arcgis/rest/services/World/GeocodeServer/";
42
- var ARCGIS_ONLINE_BULK_GEOCODING_URL = "https://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer/";
43
- /**
44
- * Used to fetch metadata from a geocoding service.
45
- *
46
- * ```js
47
- * import { getGeocoderServiceInfo } from '@esri/arcgis-rest-geocoding';
48
- *
49
- * getGeocoderServiceInfo()
50
- * .then((response) => {
51
- * response.serviceDescription; // => 'World Geocoder'
52
- * });
53
- * ```
54
- *
55
- * @param requestOptions - Request options can contain a custom geocoding service to fetch metadata from.
56
- * @returns A Promise that will resolve with the data from the response.
57
- */
58
- function getGeocodeService(requestOptions) {
59
- var url = (requestOptions && requestOptions.endpoint) || ARCGIS_ONLINE_GEOCODING_URL;
60
- var options = __assign({ httpMethod: "GET", maxUrlLength: 2000 }, requestOptions);
61
- return arcgisRestRequest.request(url, options);
62
- }
63
-
64
- /* @preserve
65
- * @terraformer/arcgis - v2.0.6 - MIT
66
- * Copyright (c) 2012-2020 Environmental Systems Research Institute, Inc.
67
- * Mon May 18 2020 14:30:35 GMT-0700 (Pacific Daylight Time)
68
- */
69
- /* Copyright (c) 2012-2019 Environmental Systems Research Institute, Inc.
70
- * Apache-2.0 */
71
-
72
- var edgeIntersectsEdge = function edgeIntersectsEdge(a1, a2, b1, b2) {
73
- var uaT = (b2[0] - b1[0]) * (a1[1] - b1[1]) - (b2[1] - b1[1]) * (a1[0] - b1[0]);
74
- var ubT = (a2[0] - a1[0]) * (a1[1] - b1[1]) - (a2[1] - a1[1]) * (a1[0] - b1[0]);
75
- var uB = (b2[1] - b1[1]) * (a2[0] - a1[0]) - (b2[0] - b1[0]) * (a2[1] - a1[1]);
76
-
77
- if (uB !== 0) {
78
- var ua = uaT / uB;
79
- var ub = ubT / uB;
80
-
81
- if (ua >= 0 && ua <= 1 && ub >= 0 && ub <= 1) {
82
- return true;
83
- }
84
- }
85
-
86
- return false;
87
- };
88
- var coordinatesContainPoint = function coordinatesContainPoint(coordinates, point) {
89
- var contains = false;
90
-
91
- for (var i = -1, l = coordinates.length, j = l - 1; ++i < l; j = i) {
92
- if ((coordinates[i][1] <= point[1] && point[1] < coordinates[j][1] || coordinates[j][1] <= point[1] && point[1] < coordinates[i][1]) && point[0] < (coordinates[j][0] - coordinates[i][0]) * (point[1] - coordinates[i][1]) / (coordinates[j][1] - coordinates[i][1]) + coordinates[i][0]) {
93
- contains = !contains;
94
- }
95
- }
96
-
97
- return contains;
98
- };
99
- var pointsEqual = function pointsEqual(a, b) {
100
- for (var i = 0; i < a.length; i++) {
101
- if (a[i] !== b[i]) {
102
- return false;
103
- }
104
- }
105
-
106
- return true;
107
- };
108
- var arrayIntersectsArray = function arrayIntersectsArray(a, b) {
109
- for (var i = 0; i < a.length - 1; i++) {
110
- for (var j = 0; j < b.length - 1; j++) {
111
- if (edgeIntersectsEdge(a[i], a[i + 1], b[j], b[j + 1])) {
112
- return true;
113
- }
114
- }
115
- }
116
-
117
- return false;
118
- };
119
-
120
- /* Copyright (c) 2012-2019 Environmental Systems Research Institute, Inc.
121
- * Apache-2.0 */
122
-
123
- var closeRing = function closeRing(coordinates) {
124
- if (!pointsEqual(coordinates[0], coordinates[coordinates.length - 1])) {
125
- coordinates.push(coordinates[0]);
126
- }
127
-
128
- return coordinates;
129
- }; // determine if polygon ring coordinates are clockwise. clockwise signifies outer ring, counter-clockwise an inner ring
130
- // or hole. this logic was found at http://stackoverflow.com/questions/1165647/how-to-determine-if-a-list-of-polygon-
131
- // points-are-in-clockwise-order
132
-
133
- var ringIsClockwise = function ringIsClockwise(ringToTest) {
134
- var total = 0;
135
- var i = 0;
136
- var rLength = ringToTest.length;
137
- var pt1 = ringToTest[i];
138
- var pt2;
139
-
140
- for (i; i < rLength - 1; i++) {
141
- pt2 = ringToTest[i + 1];
142
- total += (pt2[0] - pt1[0]) * (pt2[1] + pt1[1]);
143
- pt1 = pt2;
144
- }
145
-
146
- return total >= 0;
147
- }; // This function ensures that rings are oriented in the right directions
148
- // from http://jsperf.com/cloning-an-object/2
149
-
150
- var shallowClone = function shallowClone(obj) {
151
- var target = {};
152
-
153
- for (var i in obj) {
154
- // both arcgis attributes and geojson props are just hardcoded keys
155
- if (obj.hasOwnProperty(i)) {
156
- // eslint-disable-line no-prototype-builtins
157
- target[i] = obj[i];
158
- }
159
- }
160
-
161
- return target;
162
- };
163
-
164
- /* Copyright (c) 2012-2019 Environmental Systems Research Institute, Inc.
165
- * Apache-2.0 */
166
-
167
- var coordinatesContainCoordinates = function coordinatesContainCoordinates(outer, inner) {
168
- var intersects = arrayIntersectsArray(outer, inner);
169
- var contains = coordinatesContainPoint(outer, inner[0]);
170
-
171
- if (!intersects && contains) {
172
- return true;
173
- }
174
-
175
- return false;
176
- }; // do any polygons in this array contain any other polygons in this array?
177
- // used for checking for holes in arcgis rings
178
-
179
-
180
- var convertRingsToGeoJSON = function convertRingsToGeoJSON(rings) {
181
- var outerRings = [];
182
- var holes = [];
183
- var x; // iterator
184
-
185
- var outerRing; // current outer ring being evaluated
186
-
187
- var hole; // current hole being evaluated
188
- // for each ring
189
-
190
- for (var r = 0; r < rings.length; r++) {
191
- var ring = closeRing(rings[r].slice(0));
192
-
193
- if (ring.length < 4) {
194
- continue;
195
- } // is this ring an outer ring? is it clockwise?
196
-
197
-
198
- if (ringIsClockwise(ring)) {
199
- var polygon = [ring.slice().reverse()]; // wind outer rings counterclockwise for RFC 7946 compliance
200
-
201
- outerRings.push(polygon); // push to outer rings
202
- } else {
203
- holes.push(ring.slice().reverse()); // wind inner rings clockwise for RFC 7946 compliance
204
- }
205
- }
206
-
207
- var uncontainedHoles = []; // while there are holes left...
208
-
209
- while (holes.length) {
210
- // pop a hole off out stack
211
- hole = holes.pop(); // loop over all outer rings and see if they contain our hole.
212
-
213
- var contained = false;
214
-
215
- for (x = outerRings.length - 1; x >= 0; x--) {
216
- outerRing = outerRings[x][0];
217
-
218
- if (coordinatesContainCoordinates(outerRing, hole)) {
219
- // the hole is contained push it into our polygon
220
- outerRings[x].push(hole);
221
- contained = true;
222
- break;
223
- }
224
- } // ring is not contained in any outer ring
225
- // sometimes this happens https://github.com/Esri/esri-leaflet/issues/320
226
-
227
-
228
- if (!contained) {
229
- uncontainedHoles.push(hole);
230
- }
231
- } // if we couldn't match any holes using contains we can try intersects...
232
-
233
-
234
- while (uncontainedHoles.length) {
235
- // pop a hole off out stack
236
- hole = uncontainedHoles.pop(); // loop over all outer rings and see if any intersect our hole.
237
-
238
- var intersects = false;
239
-
240
- for (x = outerRings.length - 1; x >= 0; x--) {
241
- outerRing = outerRings[x][0];
242
-
243
- if (arrayIntersectsArray(outerRing, hole)) {
244
- // the hole is contained push it into our polygon
245
- outerRings[x].push(hole);
246
- intersects = true;
247
- break;
248
- }
249
- }
250
-
251
- if (!intersects) {
252
- outerRings.push([hole.reverse()]);
253
- }
254
- }
255
-
256
- if (outerRings.length === 1) {
257
- return {
258
- type: 'Polygon',
259
- coordinates: outerRings[0]
260
- };
261
- } else {
262
- return {
263
- type: 'MultiPolygon',
264
- coordinates: outerRings
265
- };
266
- }
267
- };
268
-
269
- var getId = function getId(attributes, idAttribute) {
270
- var keys = idAttribute ? [idAttribute, 'OBJECTID', 'FID'] : ['OBJECTID', 'FID'];
271
-
272
- for (var i = 0; i < keys.length; i++) {
273
- var key = keys[i];
274
-
275
- if (key in attributes && (typeof attributes[key] === 'string' || typeof attributes[key] === 'number')) {
276
- return attributes[key];
277
- }
278
- }
279
-
280
- throw Error('No valid id attribute found');
281
- };
282
-
283
- var arcgisToGeoJSON = function arcgisToGeoJSON(arcgis, idAttribute) {
284
- var geojson = {};
285
-
286
- if (arcgis.features) {
287
- geojson.type = 'FeatureCollection';
288
- geojson.features = [];
289
-
290
- for (var i = 0; i < arcgis.features.length; i++) {
291
- geojson.features.push(arcgisToGeoJSON(arcgis.features[i], idAttribute));
292
- }
293
- }
294
-
295
- if (typeof arcgis.x === 'number' && typeof arcgis.y === 'number') {
296
- geojson.type = 'Point';
297
- geojson.coordinates = [arcgis.x, arcgis.y];
298
-
299
- if (typeof arcgis.z === 'number') {
300
- geojson.coordinates.push(arcgis.z);
301
- }
302
- }
303
-
304
- if (arcgis.points) {
305
- geojson.type = 'MultiPoint';
306
- geojson.coordinates = arcgis.points.slice(0);
307
- }
308
-
309
- if (arcgis.paths) {
310
- if (arcgis.paths.length === 1) {
311
- geojson.type = 'LineString';
312
- geojson.coordinates = arcgis.paths[0].slice(0);
313
- } else {
314
- geojson.type = 'MultiLineString';
315
- geojson.coordinates = arcgis.paths.slice(0);
316
- }
317
- }
318
-
319
- if (arcgis.rings) {
320
- geojson = convertRingsToGeoJSON(arcgis.rings.slice(0));
321
- }
322
-
323
- if (typeof arcgis.xmin === 'number' && typeof arcgis.ymin === 'number' && typeof arcgis.xmax === 'number' && typeof arcgis.ymax === 'number') {
324
- geojson.type = 'Polygon';
325
- geojson.coordinates = [[[arcgis.xmax, arcgis.ymax], [arcgis.xmin, arcgis.ymax], [arcgis.xmin, arcgis.ymin], [arcgis.xmax, arcgis.ymin], [arcgis.xmax, arcgis.ymax]]];
326
- }
327
-
328
- if (arcgis.geometry || arcgis.attributes) {
329
- geojson.type = 'Feature';
330
- geojson.geometry = arcgis.geometry ? arcgisToGeoJSON(arcgis.geometry) : null;
331
- geojson.properties = arcgis.attributes ? shallowClone(arcgis.attributes) : null;
332
-
333
- if (arcgis.attributes) {
334
- try {
335
- geojson.id = getId(arcgis.attributes, idAttribute);
336
- } catch (err) {// don't set an id
337
- }
338
- }
339
- } // if no valid geometry was encountered
340
-
341
-
342
- if (JSON.stringify(geojson.geometry) === JSON.stringify({})) {
343
- geojson.geometry = null;
344
- }
345
-
346
- if (arcgis.spatialReference && arcgis.spatialReference.wkid && arcgis.spatialReference.wkid !== 4326) {
347
- console.warn('Object converted in non-standard crs - ' + JSON.stringify(arcgis.spatialReference));
348
- }
349
-
350
- return geojson;
351
- };
352
-
353
- /* Copyright (c) 2017-2018 Environmental Systems Research Institute, Inc.
354
- * Apache-2.0 */
355
- /**
356
- * ```js
357
- * import { geocode } from '@esri/arcgis-rest-geocoding';
358
- * //
359
- * geocode("LAX")
360
- * .then((response) => {
361
- * response.candidates[0].location; // => { x: -118.409, y: 33.943, spatialReference: ... }
362
- * });
363
- * //
364
- * geocode({
365
- * address: "1600 Pennsylvania Ave",
366
- * postal: 20500,
367
- * countryCode: "USA"
368
- * })
369
- * .then((response) => {
370
- * response.candidates[1].location; // => { x: -77.036533, y: 38.898719, spatialReference: ... }
371
- * });
372
- * ```
373
- * Used to determine the location of a single address or point of interest. See the [REST Documentation](https://developers.arcgis.com/rest/geocode/api-reference/geocoding-find-address-candidates.htm) for more information.
374
- * @param address String representing the address or point of interest or RequestOptions to pass to the endpoint.
375
- * @returns A Promise that will resolve with address candidates for the request. The spatial reference will be added to candidate locations and extents unless `rawResponse: true` was passed.
376
- */
377
- function geocode(address) {
378
- var options = {};
379
- var endpoint;
380
- if (typeof address === "string") {
381
- options.params = { singleLine: address };
382
- endpoint = ARCGIS_ONLINE_GEOCODING_URL;
383
- }
384
- else {
385
- endpoint = address.endpoint || ARCGIS_ONLINE_GEOCODING_URL;
386
- options = arcgisRestRequest.appendCustomParams(address, [
387
- "singleLine",
388
- "address",
389
- "address2",
390
- "address3",
391
- "neighborhood",
392
- "city",
393
- "subregion",
394
- "region",
395
- "postal",
396
- "postalExt",
397
- "countryCode",
398
- "outFields",
399
- "magicKey"
400
- ], { params: __assign({}, address.params) });
401
- }
402
- // add spatialReference property to individual matches
403
- return arcgisRestRequest.request(arcgisRestRequest.cleanUrl(endpoint) + "/findAddressCandidates", options).then(function (response) {
404
- if (typeof address !== "string" && address.rawResponse) {
405
- return response;
406
- }
407
- var sr = response.spatialReference;
408
- response.candidates.forEach(function (candidate) {
409
- candidate.location.spatialReference = sr;
410
- if (candidate.extent) {
411
- candidate.extent.spatialReference = sr;
412
- }
413
- });
414
- // geoJson
415
- if (sr.wkid === 4326) {
416
- var features = response.candidates.map(function (candidate) {
417
- return {
418
- type: "Feature",
419
- geometry: arcgisToGeoJSON(candidate.location),
420
- properties: Object.assign({
421
- address: candidate.address,
422
- score: candidate.score,
423
- }, candidate.attributes),
424
- };
425
- });
426
- response.geoJson = {
427
- type: "FeatureCollection",
428
- features: features,
429
- };
430
- }
431
- return response;
432
- });
433
- }
434
-
435
- /* Copyright (c) 2017-2018 Environmental Systems Research Institute, Inc.
436
- * Apache-2.0 */
437
- /**
438
- * ```js
439
- * import { suggest } from '@esri/arcgis-rest-geocoding';
440
- * //
441
- * suggest("Starb")
442
- * .then(response) // response.text === "Starbucks"
443
- * ```
444
- * Used to return a placename [suggestion](https://developers.arcgis.com/rest/geocode/api-reference/geocoding-suggest.htm) for a partial string.
445
- *
446
- * @param requestOptions - Options for the request including authentication and other optional parameters.
447
- * @returns A Promise that will resolve with the data from the response.
448
- */
449
- function suggest(partialText, requestOptions) {
450
- var options = __assign({ endpoint: ARCGIS_ONLINE_GEOCODING_URL, params: {} }, requestOptions);
451
- options.params.text = partialText;
452
- return arcgisRestRequest.request(arcgisRestRequest.cleanUrl(options.endpoint) + "/suggest", options);
453
- }
454
-
455
- /* Copyright (c) 2017-2018 Environmental Systems Research Institute, Inc.
456
- * Apache-2.0 */
457
- function isLocationArray(coords) {
458
- return (coords.length === 2 ||
459
- coords.length === 3);
460
- }
461
- function isLocation(coords) {
462
- return (coords.latitude !== undefined ||
463
- coords.lat !== undefined);
464
- }
465
- /**
466
- * ```js
467
- * import { reverseGeocode } from '@esri/arcgis-rest-geocoding';
468
- * //
469
- * reverseGeocode([-118.409,33.943 ]) // long, lat
470
- * .then((response) => {
471
- * response.address.PlaceName; // => "LA Airport"
472
- * });
473
- * // or
474
- * reverseGeocode({ long: -118.409, lat: 33.943 })
475
- * reverseGeocode({ latitude: 33.943, latitude: -118.409 })
476
- * reverseGeocode({ x: -118.409, y: 33.9425 }) // wgs84 is assumed
477
- * reverseGeocode({ x: -13181226, y: 4021085, spatialReference: { wkid: 3857 })
478
- * ```
479
- * Used to determine the address of a [location](https://developers.arcgis.com/rest/geocode/api-reference/geocoding-reverse-geocode.htm).
480
- *
481
- * @param coordinates - the location you'd like to associate an address with.
482
- * @param requestOptions - Additional options for the request including authentication.
483
- * @returns A Promise that will resolve with the data from the response.
484
- */
485
- function reverseGeocode(coords, requestOptions) {
486
- var options = __assign({ endpoint: ARCGIS_ONLINE_GEOCODING_URL, params: {} }, requestOptions);
487
- if (isLocationArray(coords)) {
488
- options.params.location = coords.join();
489
- }
490
- else if (isLocation(coords)) {
491
- if (coords.lat) {
492
- options.params.location = coords.long + "," + coords.lat;
493
- }
494
- if (coords.latitude) {
495
- options.params.location = coords.longitude + "," + coords.latitude;
496
- }
497
- }
498
- else {
499
- // if input is a point, we can pass it straight through, with or without a spatial reference
500
- options.params.location = coords;
501
- }
502
- return arcgisRestRequest.request(arcgisRestRequest.cleanUrl(options.endpoint) + "/reverseGeocode", options);
503
- }
504
-
505
- /* Copyright (c) 2017-2018 Environmental Systems Research Institute, Inc.
506
- * Apache-2.0 */
507
- /**
508
- * ```js
509
- * import { bulkGeocode } from '@esri/arcgis-rest-geocoding';
510
- * import { ApplicationSession } from '@esri/arcgis-rest-auth';
511
- * //
512
- * const addresses = [
513
- * { "OBJECTID": 1, "SingleLine": "380 New York Street 92373" },
514
- * { "OBJECTID": 2, "SingleLine": "1 World Way Los Angeles 90045" }
515
- * ];
516
- * //
517
- * bulkGeocode({ addresses, authentication: session })
518
- * .then((response) => {
519
- * response.locations[0].location; // => { x: -117, y: 34, spatialReference: { wkid: 4326 } }
520
- * });
521
- * ```
522
- * Used to geocode a [batch](https://developers.arcgis.com/rest/geocode/api-reference/geocoding-geocode-addresses.htm) of addresses.
523
- *
524
- * @param requestOptions - Request options to pass to the geocoder, including an array of addresses and authentication session.
525
- * @returns A Promise that will resolve with the data from the response. The spatial reference will be added to address locations unless `rawResponse: true` was passed.
526
- */
527
- function bulkGeocode(requestOptions // must POST, which is the default
528
- ) {
529
- var options = __assign({ endpoint: ARCGIS_ONLINE_BULK_GEOCODING_URL, params: {} }, requestOptions);
530
- options.params.addresses = {
531
- records: requestOptions.addresses.map(function (address) {
532
- return { attributes: address };
533
- })
534
- };
535
- // the SAS service does not support anonymous requests
536
- if (!requestOptions.authentication &&
537
- options.endpoint === ARCGIS_ONLINE_BULK_GEOCODING_URL) {
538
- return Promise.reject("bulk geocoding using the ArcGIS service requires authentication");
539
- }
540
- return arcgisRestRequest.request(arcgisRestRequest.cleanUrl(options.endpoint) + "/geocodeAddresses", options).then(function (response) {
541
- if (options.rawResponse) {
542
- return response;
543
- }
544
- var sr = response.spatialReference;
545
- response.locations.forEach(function (address) {
546
- if (address.location) {
547
- address.location.spatialReference = sr;
548
- }
549
- });
550
- return response;
551
- });
552
- }
553
-
554
- exports.ARCGIS_ONLINE_BULK_GEOCODING_URL = ARCGIS_ONLINE_BULK_GEOCODING_URL;
555
- exports.ARCGIS_ONLINE_GEOCODING_URL = ARCGIS_ONLINE_GEOCODING_URL;
556
- exports.bulkGeocode = bulkGeocode;
557
- exports.geocode = geocode;
558
- exports.getGeocodeService = getGeocodeService;
559
- exports.reverseGeocode = reverseGeocode;
560
- exports.suggest = suggest;
561
-
562
- Object.defineProperty(exports, '__esModule', { value: true });
563
-
564
- })));
565
- //# sourceMappingURL=geocoding.umd.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"geocoding.umd.js","sources":["../../src/helpers.ts","../../node_modules/@terraformer/arcgis/dist/t-arcgis.esm.js","../../src/geocode.ts","../../src/suggest.ts","../../src/reverse.ts","../../src/bulk.ts"],"sourcesContent":["/* Copyright (c) 2017 Environmental Systems Research Institute, Inc.\n * Apache-2.0 */\n\nimport { request, IRequestOptions } from \"@esri/arcgis-rest-request\";\n\n// https always\nexport const ARCGIS_ONLINE_GEOCODING_URL =\n \"https://geocode-api.arcgis.com/arcgis/rest/services/World/GeocodeServer/\";\nexport const ARCGIS_ONLINE_BULK_GEOCODING_URL =\n \"https://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer/\";\n\n// nice to have: verify custom endpoints contain 'GeocodeServer' and end in a '/'\nexport interface IEndpointOptions extends IRequestOptions {\n /**\n * Any ArcGIS Geocoding service (example: http://sampleserver6.arcgisonline.com/arcgis/rest/services/Locators/SanDiego/GeocodeServer )\n */\n endpoint?: string;\n}\n\nexport interface IGetGeocodeServiceResponse {\n currentVersion: number;\n serviceDescription: string;\n addressFields: any[];\n countries: string[];\n capabilities: string;\n}\n\n/**\n * Used to fetch metadata from a geocoding service.\n *\n * ```js\n * import { getGeocoderServiceInfo } from '@esri/arcgis-rest-geocoding';\n *\n * getGeocoderServiceInfo()\n * .then((response) => {\n * response.serviceDescription; // => 'World Geocoder'\n * });\n * ```\n *\n * @param requestOptions - Request options can contain a custom geocoding service to fetch metadata from.\n * @returns A Promise that will resolve with the data from the response.\n */\nexport function getGeocodeService(\n requestOptions?: IEndpointOptions\n): Promise<IGetGeocodeServiceResponse> {\n const url =\n (requestOptions && requestOptions.endpoint) || ARCGIS_ONLINE_GEOCODING_URL;\n\n const options: IEndpointOptions = {\n httpMethod: \"GET\",\n maxUrlLength: 2000,\n ...requestOptions\n };\n\n return request(url, options);\n}\n","/* @preserve\n* @terraformer/arcgis - v2.0.6 - MIT\n* Copyright (c) 2012-2020 Environmental Systems Research Institute, Inc.\n* Mon May 18 2020 14:30:35 GMT-0700 (Pacific Daylight Time)\n*/\n/* Copyright (c) 2012-2019 Environmental Systems Research Institute, Inc.\n * Apache-2.0 */\n\nvar edgeIntersectsEdge = function edgeIntersectsEdge(a1, a2, b1, b2) {\n var uaT = (b2[0] - b1[0]) * (a1[1] - b1[1]) - (b2[1] - b1[1]) * (a1[0] - b1[0]);\n var ubT = (a2[0] - a1[0]) * (a1[1] - b1[1]) - (a2[1] - a1[1]) * (a1[0] - b1[0]);\n var uB = (b2[1] - b1[1]) * (a2[0] - a1[0]) - (b2[0] - b1[0]) * (a2[1] - a1[1]);\n\n if (uB !== 0) {\n var ua = uaT / uB;\n var ub = ubT / uB;\n\n if (ua >= 0 && ua <= 1 && ub >= 0 && ub <= 1) {\n return true;\n }\n }\n\n return false;\n};\nvar coordinatesContainPoint = function coordinatesContainPoint(coordinates, point) {\n var contains = false;\n\n for (var i = -1, l = coordinates.length, j = l - 1; ++i < l; j = i) {\n if ((coordinates[i][1] <= point[1] && point[1] < coordinates[j][1] || coordinates[j][1] <= point[1] && point[1] < coordinates[i][1]) && point[0] < (coordinates[j][0] - coordinates[i][0]) * (point[1] - coordinates[i][1]) / (coordinates[j][1] - coordinates[i][1]) + coordinates[i][0]) {\n contains = !contains;\n }\n }\n\n return contains;\n};\nvar pointsEqual = function pointsEqual(a, b) {\n for (var i = 0; i < a.length; i++) {\n if (a[i] !== b[i]) {\n return false;\n }\n }\n\n return true;\n};\nvar arrayIntersectsArray = function arrayIntersectsArray(a, b) {\n for (var i = 0; i < a.length - 1; i++) {\n for (var j = 0; j < b.length - 1; j++) {\n if (edgeIntersectsEdge(a[i], a[i + 1], b[j], b[j + 1])) {\n return true;\n }\n }\n }\n\n return false;\n};\n\n/* Copyright (c) 2012-2019 Environmental Systems Research Institute, Inc.\n * Apache-2.0 */\n\nvar closeRing = function closeRing(coordinates) {\n if (!pointsEqual(coordinates[0], coordinates[coordinates.length - 1])) {\n coordinates.push(coordinates[0]);\n }\n\n return coordinates;\n}; // determine if polygon ring coordinates are clockwise. clockwise signifies outer ring, counter-clockwise an inner ring\n// or hole. this logic was found at http://stackoverflow.com/questions/1165647/how-to-determine-if-a-list-of-polygon-\n// points-are-in-clockwise-order\n\nvar ringIsClockwise = function ringIsClockwise(ringToTest) {\n var total = 0;\n var i = 0;\n var rLength = ringToTest.length;\n var pt1 = ringToTest[i];\n var pt2;\n\n for (i; i < rLength - 1; i++) {\n pt2 = ringToTest[i + 1];\n total += (pt2[0] - pt1[0]) * (pt2[1] + pt1[1]);\n pt1 = pt2;\n }\n\n return total >= 0;\n}; // This function ensures that rings are oriented in the right directions\n// from http://jsperf.com/cloning-an-object/2\n\nvar shallowClone = function shallowClone(obj) {\n var target = {};\n\n for (var i in obj) {\n // both arcgis attributes and geojson props are just hardcoded keys\n if (obj.hasOwnProperty(i)) {\n // eslint-disable-line no-prototype-builtins\n target[i] = obj[i];\n }\n }\n\n return target;\n};\n\n/* Copyright (c) 2012-2019 Environmental Systems Research Institute, Inc.\n * Apache-2.0 */\n\nvar coordinatesContainCoordinates = function coordinatesContainCoordinates(outer, inner) {\n var intersects = arrayIntersectsArray(outer, inner);\n var contains = coordinatesContainPoint(outer, inner[0]);\n\n if (!intersects && contains) {\n return true;\n }\n\n return false;\n}; // do any polygons in this array contain any other polygons in this array?\n// used for checking for holes in arcgis rings\n\n\nvar convertRingsToGeoJSON = function convertRingsToGeoJSON(rings) {\n var outerRings = [];\n var holes = [];\n var x; // iterator\n\n var outerRing; // current outer ring being evaluated\n\n var hole; // current hole being evaluated\n // for each ring\n\n for (var r = 0; r < rings.length; r++) {\n var ring = closeRing(rings[r].slice(0));\n\n if (ring.length < 4) {\n continue;\n } // is this ring an outer ring? is it clockwise?\n\n\n if (ringIsClockwise(ring)) {\n var polygon = [ring.slice().reverse()]; // wind outer rings counterclockwise for RFC 7946 compliance\n\n outerRings.push(polygon); // push to outer rings\n } else {\n holes.push(ring.slice().reverse()); // wind inner rings clockwise for RFC 7946 compliance\n }\n }\n\n var uncontainedHoles = []; // while there are holes left...\n\n while (holes.length) {\n // pop a hole off out stack\n hole = holes.pop(); // loop over all outer rings and see if they contain our hole.\n\n var contained = false;\n\n for (x = outerRings.length - 1; x >= 0; x--) {\n outerRing = outerRings[x][0];\n\n if (coordinatesContainCoordinates(outerRing, hole)) {\n // the hole is contained push it into our polygon\n outerRings[x].push(hole);\n contained = true;\n break;\n }\n } // ring is not contained in any outer ring\n // sometimes this happens https://github.com/Esri/esri-leaflet/issues/320\n\n\n if (!contained) {\n uncontainedHoles.push(hole);\n }\n } // if we couldn't match any holes using contains we can try intersects...\n\n\n while (uncontainedHoles.length) {\n // pop a hole off out stack\n hole = uncontainedHoles.pop(); // loop over all outer rings and see if any intersect our hole.\n\n var intersects = false;\n\n for (x = outerRings.length - 1; x >= 0; x--) {\n outerRing = outerRings[x][0];\n\n if (arrayIntersectsArray(outerRing, hole)) {\n // the hole is contained push it into our polygon\n outerRings[x].push(hole);\n intersects = true;\n break;\n }\n }\n\n if (!intersects) {\n outerRings.push([hole.reverse()]);\n }\n }\n\n if (outerRings.length === 1) {\n return {\n type: 'Polygon',\n coordinates: outerRings[0]\n };\n } else {\n return {\n type: 'MultiPolygon',\n coordinates: outerRings\n };\n }\n};\n\nvar getId = function getId(attributes, idAttribute) {\n var keys = idAttribute ? [idAttribute, 'OBJECTID', 'FID'] : ['OBJECTID', 'FID'];\n\n for (var i = 0; i < keys.length; i++) {\n var key = keys[i];\n\n if (key in attributes && (typeof attributes[key] === 'string' || typeof attributes[key] === 'number')) {\n return attributes[key];\n }\n }\n\n throw Error('No valid id attribute found');\n};\n\nvar arcgisToGeoJSON = function arcgisToGeoJSON(arcgis, idAttribute) {\n var geojson = {};\n\n if (arcgis.features) {\n geojson.type = 'FeatureCollection';\n geojson.features = [];\n\n for (var i = 0; i < arcgis.features.length; i++) {\n geojson.features.push(arcgisToGeoJSON(arcgis.features[i], idAttribute));\n }\n }\n\n if (typeof arcgis.x === 'number' && typeof arcgis.y === 'number') {\n geojson.type = 'Point';\n geojson.coordinates = [arcgis.x, arcgis.y];\n\n if (typeof arcgis.z === 'number') {\n geojson.coordinates.push(arcgis.z);\n }\n }\n\n if (arcgis.points) {\n geojson.type = 'MultiPoint';\n geojson.coordinates = arcgis.points.slice(0);\n }\n\n if (arcgis.paths) {\n if (arcgis.paths.length === 1) {\n geojson.type = 'LineString';\n geojson.coordinates = arcgis.paths[0].slice(0);\n } else {\n geojson.type = 'MultiLineString';\n geojson.coordinates = arcgis.paths.slice(0);\n }\n }\n\n if (arcgis.rings) {\n geojson = convertRingsToGeoJSON(arcgis.rings.slice(0));\n }\n\n if (typeof arcgis.xmin === 'number' && typeof arcgis.ymin === 'number' && typeof arcgis.xmax === 'number' && typeof arcgis.ymax === 'number') {\n geojson.type = 'Polygon';\n geojson.coordinates = [[[arcgis.xmax, arcgis.ymax], [arcgis.xmin, arcgis.ymax], [arcgis.xmin, arcgis.ymin], [arcgis.xmax, arcgis.ymin], [arcgis.xmax, arcgis.ymax]]];\n }\n\n if (arcgis.geometry || arcgis.attributes) {\n geojson.type = 'Feature';\n geojson.geometry = arcgis.geometry ? arcgisToGeoJSON(arcgis.geometry) : null;\n geojson.properties = arcgis.attributes ? shallowClone(arcgis.attributes) : null;\n\n if (arcgis.attributes) {\n try {\n geojson.id = getId(arcgis.attributes, idAttribute);\n } catch (err) {// don't set an id\n }\n }\n } // if no valid geometry was encountered\n\n\n if (JSON.stringify(geojson.geometry) === JSON.stringify({})) {\n geojson.geometry = null;\n }\n\n if (arcgis.spatialReference && arcgis.spatialReference.wkid && arcgis.spatialReference.wkid !== 4326) {\n console.warn('Object converted in non-standard crs - ' + JSON.stringify(arcgis.spatialReference));\n }\n\n return geojson;\n};\n\n/* Copyright (c) 2012-2019 Environmental Systems Research Institute, Inc.\n * Apache-2.0 */\n// outer rings are clockwise, holes are counterclockwise\n// used for converting GeoJSON Polygons to ArcGIS Polygons\n\nvar orientRings = function orientRings(poly) {\n var output = [];\n var polygon = poly.slice(0);\n var outerRing = closeRing(polygon.shift().slice(0));\n\n if (outerRing.length >= 4) {\n if (!ringIsClockwise(outerRing)) {\n outerRing.reverse();\n }\n\n output.push(outerRing);\n\n for (var i = 0; i < polygon.length; i++) {\n var hole = closeRing(polygon[i].slice(0));\n\n if (hole.length >= 4) {\n if (ringIsClockwise(hole)) {\n hole.reverse();\n }\n\n output.push(hole);\n }\n }\n }\n\n return output;\n}; // This function flattens holes in multipolygons to one array of polygons\n// used for converting GeoJSON Polygons to ArcGIS Polygons\n\n\nvar flattenMultiPolygonRings = function flattenMultiPolygonRings(rings) {\n var output = [];\n\n for (var i = 0; i < rings.length; i++) {\n var polygon = orientRings(rings[i]);\n\n for (var x = polygon.length - 1; x >= 0; x--) {\n var ring = polygon[x].slice(0);\n output.push(ring);\n }\n }\n\n return output;\n};\n\nvar geojsonToArcGIS = function geojsonToArcGIS(geojson, idAttribute) {\n idAttribute = idAttribute || 'OBJECTID';\n var spatialReference = {\n wkid: 4326\n };\n var result = {};\n var i;\n\n switch (geojson.type) {\n case 'Point':\n result.x = geojson.coordinates[0];\n result.y = geojson.coordinates[1];\n result.spatialReference = spatialReference;\n break;\n\n case 'MultiPoint':\n result.points = geojson.coordinates.slice(0);\n result.spatialReference = spatialReference;\n break;\n\n case 'LineString':\n result.paths = [geojson.coordinates.slice(0)];\n result.spatialReference = spatialReference;\n break;\n\n case 'MultiLineString':\n result.paths = geojson.coordinates.slice(0);\n result.spatialReference = spatialReference;\n break;\n\n case 'Polygon':\n result.rings = orientRings(geojson.coordinates.slice(0));\n result.spatialReference = spatialReference;\n break;\n\n case 'MultiPolygon':\n result.rings = flattenMultiPolygonRings(geojson.coordinates.slice(0));\n result.spatialReference = spatialReference;\n break;\n\n case 'Feature':\n if (geojson.geometry) {\n result.geometry = geojsonToArcGIS(geojson.geometry, idAttribute);\n }\n\n result.attributes = geojson.properties ? shallowClone(geojson.properties) : {};\n\n if (geojson.id) {\n result.attributes[idAttribute] = geojson.id;\n }\n\n break;\n\n case 'FeatureCollection':\n result = [];\n\n for (i = 0; i < geojson.features.length; i++) {\n result.push(geojsonToArcGIS(geojson.features[i], idAttribute));\n }\n\n break;\n\n case 'GeometryCollection':\n result = [];\n\n for (i = 0; i < geojson.geometries.length; i++) {\n result.push(geojsonToArcGIS(geojson.geometries[i], idAttribute));\n }\n\n break;\n }\n\n return result;\n};\n\n/* Copyright (c) 2012-2019 Environmental Systems Research Institute, Inc.\n * Apache-2.0 */\n\nexport { arcgisToGeoJSON, geojsonToArcGIS };\n","/* Copyright (c) 2017-2018 Environmental Systems Research Institute, Inc.\n * Apache-2.0 */\n\nimport {\n request,\n cleanUrl,\n appendCustomParams\n} from \"@esri/arcgis-rest-request\";\n\nimport { IExtent, ISpatialReference, IPoint } from \"@esri/arcgis-rest-types\";\n\nimport { ARCGIS_ONLINE_GEOCODING_URL, IEndpointOptions } from \"./helpers\";\n\nimport { arcgisToGeoJSON } from \"@terraformer/arcgis\";\n\nexport interface IGeocodeOptions extends IEndpointOptions {\n /**\n * use this if all your address info is contained in a single string.\n */\n singleLine?: string;\n address?: string;\n address2?: string;\n address3?: string;\n neighborhood?: string;\n city?: string;\n subregion?: string;\n outFields?: \"*\" | string[];\n /**\n * The World Geocoding Service expects US states to be passed in as a 'region'.\n */\n region?: string;\n postal?: number;\n postalExt?: number;\n countryCode?: string;\n /**\n * You can create an autocomplete experience by making a call to suggest with partial text and then passing through the magicKey and complete address that are returned to geocode.\n * ```js\n * import { suggest, geocode } from '@esri/arcgis-rest-geocoding';\n * suggest(\"LAX\")\n * .then((response) => {\n * geocode({\n * singleLine: response.suggestions[1].text,\n * magicKey: response.suggestions[0].magicKey\n * })\n * })\n * ```\n */\n magicKey?: string;\n}\n\nexport interface IGeocodeResponse {\n spatialReference: ISpatialReference;\n candidates: Array<{\n address: string;\n location: IPoint;\n extent?: IExtent;\n score: number;\n attributes: object;\n }>;\n geoJson?: {\n type: string;\n features: Array<{\n type: string;\n geometry: object;\n properties: any;\n }>\n };\n}\n\n/**\n * ```js\n * import { geocode } from '@esri/arcgis-rest-geocoding';\n * //\n * geocode(\"LAX\")\n * .then((response) => {\n * response.candidates[0].location; // => { x: -118.409, y: 33.943, spatialReference: ... }\n * });\n * //\n * geocode({\n * address: \"1600 Pennsylvania Ave\",\n * postal: 20500,\n * countryCode: \"USA\"\n * })\n * .then((response) => {\n * response.candidates[1].location; // => { x: -77.036533, y: 38.898719, spatialReference: ... }\n * });\n * ```\n * Used to determine the location of a single address or point of interest. See the [REST Documentation](https://developers.arcgis.com/rest/geocode/api-reference/geocoding-find-address-candidates.htm) for more information.\n * @param address String representing the address or point of interest or RequestOptions to pass to the endpoint.\n * @returns A Promise that will resolve with address candidates for the request. The spatial reference will be added to candidate locations and extents unless `rawResponse: true` was passed.\n */\nexport function geocode(\n address: string | IGeocodeOptions\n): Promise<IGeocodeResponse> {\n let options: IGeocodeOptions = {};\n let endpoint: string;\n\n if (typeof address === \"string\") {\n options.params = { singleLine: address };\n endpoint = ARCGIS_ONLINE_GEOCODING_URL;\n } else {\n endpoint = address.endpoint || ARCGIS_ONLINE_GEOCODING_URL;\n options = appendCustomParams<IGeocodeOptions>(\n address,\n [\n \"singleLine\",\n \"address\",\n \"address2\",\n \"address3\",\n \"neighborhood\",\n \"city\",\n \"subregion\",\n \"region\",\n \"postal\",\n \"postalExt\",\n \"countryCode\",\n \"outFields\",\n \"magicKey\"\n ],\n { params: { ...address.params } }\n );\n }\n\n // add spatialReference property to individual matches\n return request(`${cleanUrl(endpoint)}/findAddressCandidates`, options).then(\n response => {\n if (typeof address !== \"string\" && address.rawResponse) {\n return response;\n }\n const sr: ISpatialReference = response.spatialReference;\n response.candidates.forEach(function(candidate: {\n location: IPoint;\n extent?: IExtent;\n }) {\n candidate.location.spatialReference = sr;\n if (candidate.extent) {\n candidate.extent.spatialReference = sr;\n }\n });\n\n // geoJson\n if (sr.wkid === 4326) {\n const features = response.candidates.map((candidate: any) => {\n return {\n type: \"Feature\",\n geometry: arcgisToGeoJSON(candidate.location),\n properties: Object.assign(\n {\n address: candidate.address,\n score: candidate.score,\n },\n candidate.attributes\n ),\n };\n });\n\n response.geoJson = {\n type: \"FeatureCollection\",\n features,\n };\n }\n\n return response;\n }\n );\n}\n","/* Copyright (c) 2017-2018 Environmental Systems Research Institute, Inc.\n * Apache-2.0 */\n\nimport { request, cleanUrl } from \"@esri/arcgis-rest-request\";\n\nimport { ARCGIS_ONLINE_GEOCODING_URL, IEndpointOptions } from \"./helpers\";\n\nexport interface ISuggestResponse {\n suggestions: Array<{\n text: string;\n magicKey: string;\n isCollection: boolean;\n }>;\n}\n\n/**\n * ```js\n * import { suggest } from '@esri/arcgis-rest-geocoding';\n * //\n * suggest(\"Starb\")\n * .then(response) // response.text === \"Starbucks\"\n * ```\n * Used to return a placename [suggestion](https://developers.arcgis.com/rest/geocode/api-reference/geocoding-suggest.htm) for a partial string.\n *\n * @param requestOptions - Options for the request including authentication and other optional parameters.\n * @returns A Promise that will resolve with the data from the response.\n */\nexport function suggest(\n partialText: string,\n requestOptions?: IEndpointOptions\n): Promise<ISuggestResponse> {\n const options: IEndpointOptions = {\n endpoint: ARCGIS_ONLINE_GEOCODING_URL,\n params: {},\n ...requestOptions\n };\n\n options.params.text = partialText;\n\n return request(`${cleanUrl(options.endpoint)}/suggest`, options);\n}\n\nexport default {\n suggest\n};\n","/* Copyright (c) 2017-2018 Environmental Systems Research Institute, Inc.\n * Apache-2.0 */\n\nimport { request, cleanUrl } from \"@esri/arcgis-rest-request\";\n\nimport { IPoint, ILocation } from \"@esri/arcgis-rest-types\";\n\nimport { ARCGIS_ONLINE_GEOCODING_URL, IEndpointOptions } from \"./helpers\";\n\nexport interface IReverseGeocodeResponse {\n address: {\n [key: string]: any;\n };\n location: IPoint;\n}\n\nfunction isLocationArray(\n coords: ILocation | IPoint | [number, number] | [number, number, number]\n): coords is [number, number] | [number, number, number] {\n return (\n (coords as [number, number]).length === 2 ||\n (coords as [number, number, number]).length === 3\n );\n}\n\nfunction isLocation(\n coords: ILocation | IPoint | [number, number] | [number, number, number]\n): coords is ILocation {\n return (\n (coords as ILocation).latitude !== undefined ||\n (coords as ILocation).lat !== undefined\n );\n}\n\n/**\n * ```js\n * import { reverseGeocode } from '@esri/arcgis-rest-geocoding';\n * //\n * reverseGeocode([-118.409,33.943 ]) // long, lat\n * .then((response) => {\n * response.address.PlaceName; // => \"LA Airport\"\n * });\n * // or\n * reverseGeocode({ long: -118.409, lat: 33.943 })\n * reverseGeocode({ latitude: 33.943, latitude: -118.409 })\n * reverseGeocode({ x: -118.409, y: 33.9425 }) // wgs84 is assumed\n * reverseGeocode({ x: -13181226, y: 4021085, spatialReference: { wkid: 3857 })\n * ```\n * Used to determine the address of a [location](https://developers.arcgis.com/rest/geocode/api-reference/geocoding-reverse-geocode.htm).\n *\n * @param coordinates - the location you'd like to associate an address with.\n * @param requestOptions - Additional options for the request including authentication.\n * @returns A Promise that will resolve with the data from the response.\n */\nexport function reverseGeocode(\n coords: IPoint | ILocation | [number, number],\n requestOptions?: IEndpointOptions\n): Promise<IReverseGeocodeResponse> {\n const options: IEndpointOptions = {\n endpoint: ARCGIS_ONLINE_GEOCODING_URL,\n params: {},\n ...requestOptions\n };\n\n if (isLocationArray(coords)) {\n options.params.location = coords.join();\n } else if (isLocation(coords)) {\n if (coords.lat) {\n options.params.location = coords.long + \",\" + coords.lat;\n }\n if (coords.latitude) {\n options.params.location = coords.longitude + \",\" + coords.latitude;\n }\n } else {\n // if input is a point, we can pass it straight through, with or without a spatial reference\n options.params.location = coords;\n }\n\n return request(`${cleanUrl(options.endpoint)}/reverseGeocode`, options);\n}\n\nexport default {\n reverseGeocode\n};\n","/* Copyright (c) 2017-2018 Environmental Systems Research Institute, Inc.\n * Apache-2.0 */\n\nimport { request, cleanUrl } from \"@esri/arcgis-rest-request\";\nimport { ISpatialReference, IPoint } from \"@esri/arcgis-rest-types\";\n\nimport { ARCGIS_ONLINE_BULK_GEOCODING_URL, IEndpointOptions } from \"./helpers\";\n\n// It would be better if doc did not display these properties in alphabetical order\nexport interface IAddressBulk {\n /**\n * A unique id must be passed along for each individual address.\n */\n OBJECTID: number;\n address?: string;\n address2?: string;\n address3?: string;\n neighborhood?: string;\n city?: string;\n subregion?: string;\n /**\n * The World Geocoding Service considers US states regions.\n */\n region?: string;\n postal?: number;\n postalExt?: number;\n countryCode?: string;\n}\n\nexport interface IBulkGeocodeOptions extends IEndpointOptions {\n addresses: IAddressBulk[];\n}\n\nexport interface IBulkGeocodeResponse {\n spatialReference: ISpatialReference;\n locations: Array<{\n address: string;\n location?: IPoint; // candidates with a score of 0 wont include a location\n score: number;\n attributes: object;\n }>;\n}\n\n/**\n * ```js\n * import { bulkGeocode } from '@esri/arcgis-rest-geocoding';\n * import { ApplicationSession } from '@esri/arcgis-rest-auth';\n * //\n * const addresses = [\n * { \"OBJECTID\": 1, \"SingleLine\": \"380 New York Street 92373\" },\n * { \"OBJECTID\": 2, \"SingleLine\": \"1 World Way Los Angeles 90045\" }\n * ];\n * //\n * bulkGeocode({ addresses, authentication: session })\n * .then((response) => {\n * response.locations[0].location; // => { x: -117, y: 34, spatialReference: { wkid: 4326 } }\n * });\n * ```\n * Used to geocode a [batch](https://developers.arcgis.com/rest/geocode/api-reference/geocoding-geocode-addresses.htm) of addresses.\n *\n * @param requestOptions - Request options to pass to the geocoder, including an array of addresses and authentication session.\n * @returns A Promise that will resolve with the data from the response. The spatial reference will be added to address locations unless `rawResponse: true` was passed.\n */\nexport function bulkGeocode(\n requestOptions: IBulkGeocodeOptions // must POST, which is the default\n): Promise<IBulkGeocodeResponse> {\n const options: IBulkGeocodeOptions = {\n endpoint: ARCGIS_ONLINE_BULK_GEOCODING_URL,\n params: {},\n ...requestOptions\n };\n\n options.params.addresses = {\n records: requestOptions.addresses.map(address => {\n return { attributes: address };\n })\n };\n\n // the SAS service does not support anonymous requests\n if (\n !requestOptions.authentication &&\n options.endpoint === ARCGIS_ONLINE_BULK_GEOCODING_URL\n ) {\n return Promise.reject(\n \"bulk geocoding using the ArcGIS service requires authentication\"\n );\n }\n\n return request(\n `${cleanUrl(options.endpoint)}/geocodeAddresses`,\n options\n ).then(response => {\n if (options.rawResponse) {\n return response;\n }\n const sr = response.spatialReference;\n response.locations.forEach(function(address: { location: IPoint }) {\n if (address.location) {\n address.location.spatialReference = sr;\n }\n });\n return response;\n });\n}\n"],"names":["request","appendCustomParams","cleanUrl"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAAA;;IAKA;QACa,2BAA2B,GACtC,2EAA2E;QAChE,gCAAgC,GAC3C,uEAAuE;IAkBzE;;;;;;;;;;;;;;;aAegB,iBAAiB,CAC/B,cAAiC;QAEjC,IAAM,GAAG,GACP,CAAC,cAAc,IAAI,cAAc,CAAC,QAAQ,KAAK,2BAA2B,CAAC;QAE7E,IAAM,OAAO,cACX,UAAU,EAAE,KAAK,EACjB,YAAY,EAAE,IAAI,IACf,cAAc,CAClB,CAAC;QAEF,OAAOA,yBAAO,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;IAC/B;;ICvDA;IACA;IACA;IACA;IACA;IACA;IACA;AACA;IACA,IAAI,kBAAkB,GAAG,SAAS,kBAAkB,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE;IACrE,EAAE,IAAI,GAAG,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;IAClF,EAAE,IAAI,GAAG,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,G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