@esri/arcgis-rest-geocoding 4.0.0-beta.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.
- package/dist/bundled/geocoding.esm.js +17 -12
- package/dist/bundled/geocoding.esm.js.map +1 -1
- package/dist/bundled/geocoding.esm.min.js +2 -2
- package/dist/bundled/geocoding.esm.min.js.map +1 -1
- package/dist/bundled/geocoding.umd.js +17 -12
- package/dist/bundled/geocoding.umd.js.map +1 -1
- package/dist/bundled/geocoding.umd.min.js +2 -2
- package/dist/bundled/geocoding.umd.min.js.map +1 -1
- package/dist/cjs/bulk.js +5 -4
- package/dist/cjs/bulk.js.map +1 -1
- package/dist/cjs/geocode.js +6 -4
- package/dist/cjs/geocode.js.map +1 -1
- package/dist/cjs/reverse.js +2 -1
- package/dist/cjs/reverse.js.map +1 -1
- package/dist/cjs/suggest.js +2 -1
- package/dist/cjs/suggest.js.map +1 -1
- package/dist/esm/bulk.d.ts +5 -4
- package/dist/esm/bulk.js +5 -4
- package/dist/esm/bulk.js.map +1 -1
- package/dist/esm/geocode.d.ts +6 -4
- package/dist/esm/geocode.js +6 -4
- package/dist/esm/geocode.js.map +1 -1
- package/dist/esm/reverse.d.ts +2 -1
- package/dist/esm/reverse.js +2 -1
- package/dist/esm/reverse.js.map +1 -1
- package/dist/esm/suggest.d.ts +2 -1
- package/dist/esm/suggest.js +2 -1
- package/dist/esm/suggest.js.map +1 -1
- package/package.json +12 -3
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/* @preserve
|
|
2
|
-
* @esri/arcgis-rest-geocoding - v4.0.0-beta.
|
|
2
|
+
* @esri/arcgis-rest-geocoding - v4.0.0-beta.5 - Apache-2.0
|
|
3
3
|
* Copyright (c) 2017-2022 Esri, Inc.
|
|
4
|
-
*
|
|
4
|
+
* Tue May 10 2022 02:53:32 GMT+0000 (Coordinated Universal Time)
|
|
5
5
|
*/
|
|
6
6
|
import { request, appendCustomParams, cleanUrl } from '@esri/arcgis-rest-request';
|
|
7
7
|
|
|
@@ -323,14 +323,16 @@ var arcgisToGeoJSON = function arcgisToGeoJSON(arcgis, idAttribute) {
|
|
|
323
323
|
/* Copyright (c) 2017-2018 Environmental Systems Research Institute, Inc.
|
|
324
324
|
* Apache-2.0 */
|
|
325
325
|
/**
|
|
326
|
-
*
|
|
326
|
+
* 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.
|
|
327
|
+
*
|
|
328
|
+
* ```js
|
|
327
329
|
* import { geocode } from '@esri/arcgis-rest-geocoding';
|
|
328
|
-
*
|
|
330
|
+
*
|
|
329
331
|
* geocode("LAX")
|
|
330
332
|
* .then((response) => {
|
|
331
333
|
* response.candidates[0].location; // => { x: -118.409, y: 33.943, spatialReference: ... }
|
|
332
334
|
* });
|
|
333
|
-
*
|
|
335
|
+
*
|
|
334
336
|
* geocode({
|
|
335
337
|
* address: "1600 Pennsylvania Ave",
|
|
336
338
|
* postal: 20500,
|
|
@@ -340,7 +342,7 @@ var arcgisToGeoJSON = function arcgisToGeoJSON(arcgis, idAttribute) {
|
|
|
340
342
|
* response.candidates[1].location; // => { x: -77.036533, y: 38.898719, spatialReference: ... }
|
|
341
343
|
* });
|
|
342
344
|
* ```
|
|
343
|
-
*
|
|
345
|
+
*
|
|
344
346
|
* @param address String representing the address or point of interest or RequestOptions to pass to the endpoint.
|
|
345
347
|
* @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.
|
|
346
348
|
*/
|
|
@@ -405,13 +407,14 @@ function geocode(address) {
|
|
|
405
407
|
/* Copyright (c) 2017-2018 Environmental Systems Research Institute, Inc.
|
|
406
408
|
* Apache-2.0 */
|
|
407
409
|
/**
|
|
410
|
+
* Used to return a placename [suggestion](https://developers.arcgis.com/rest/geocode/api-reference/geocoding-suggest.htm) for a partial string.
|
|
411
|
+
*
|
|
408
412
|
* ```js
|
|
409
413
|
* import { suggest } from '@esri/arcgis-rest-geocoding';
|
|
410
414
|
* //
|
|
411
415
|
* suggest("Starb")
|
|
412
416
|
* .then(response) // response.text === "Starbucks"
|
|
413
417
|
* ```
|
|
414
|
-
* Used to return a placename [suggestion](https://developers.arcgis.com/rest/geocode/api-reference/geocoding-suggest.htm) for a partial string.
|
|
415
418
|
*
|
|
416
419
|
* @param requestOptions - Options for the request including authentication and other optional parameters.
|
|
417
420
|
* @returns A Promise that will resolve with the data from the response.
|
|
@@ -433,6 +436,8 @@ function isLocation(coords) {
|
|
|
433
436
|
coords.lat !== undefined);
|
|
434
437
|
}
|
|
435
438
|
/**
|
|
439
|
+
* Used to determine the address of a [location](https://developers.arcgis.com/rest/geocode/api-reference/geocoding-reverse-geocode.htm).
|
|
440
|
+
*
|
|
436
441
|
* ```js
|
|
437
442
|
* import { reverseGeocode } from '@esri/arcgis-rest-geocoding';
|
|
438
443
|
* //
|
|
@@ -446,7 +451,6 @@ function isLocation(coords) {
|
|
|
446
451
|
* reverseGeocode({ x: -118.409, y: 33.9425 }) // wgs84 is assumed
|
|
447
452
|
* reverseGeocode({ x: -13181226, y: 4021085, spatialReference: { wkid: 3857 })
|
|
448
453
|
* ```
|
|
449
|
-
* Used to determine the address of a [location](https://developers.arcgis.com/rest/geocode/api-reference/geocoding-reverse-geocode.htm).
|
|
450
454
|
*
|
|
451
455
|
* @param coordinates - the location you'd like to associate an address with.
|
|
452
456
|
* @param requestOptions - Additional options for the request including authentication.
|
|
@@ -475,21 +479,22 @@ function reverseGeocode(coords, requestOptions) {
|
|
|
475
479
|
/* Copyright (c) 2017-2018 Environmental Systems Research Institute, Inc.
|
|
476
480
|
* Apache-2.0 */
|
|
477
481
|
/**
|
|
482
|
+
* Used to geocode a [batch](https://developers.arcgis.com/rest/geocode/api-reference/geocoding-geocode-addresses.htm) of addresses.
|
|
483
|
+
*
|
|
478
484
|
* ```js
|
|
479
485
|
* import { bulkGeocode } from '@esri/arcgis-rest-geocoding';
|
|
480
|
-
* import {
|
|
481
|
-
*
|
|
486
|
+
* import { ApplicationCredentialsManager } from '@esri/arcgis-rest-request';
|
|
487
|
+
*
|
|
482
488
|
* const addresses = [
|
|
483
489
|
* { "OBJECTID": 1, "SingleLine": "380 New York Street 92373" },
|
|
484
490
|
* { "OBJECTID": 2, "SingleLine": "1 World Way Los Angeles 90045" }
|
|
485
491
|
* ];
|
|
486
|
-
*
|
|
492
|
+
*
|
|
487
493
|
* bulkGeocode({ addresses, authentication: session })
|
|
488
494
|
* .then((response) => {
|
|
489
495
|
* response.locations[0].location; // => { x: -117, y: 34, spatialReference: { wkid: 4326 } }
|
|
490
496
|
* });
|
|
491
497
|
* ```
|
|
492
|
-
* Used to geocode a [batch](https://developers.arcgis.com/rest/geocode/api-reference/geocoding-geocode-addresses.htm) of addresses.
|
|
493
498
|
*
|
|
494
499
|
* @param requestOptions - Request options to pass to the geocoder, including an array of addresses and authentication session.
|
|
495
500
|
* @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.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"geocoding.esm.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.7 - MIT\n* Copyright (c) 2012-2021 Environmental Systems Research Institute, Inc.\n* Thu Jul 22 2021 13:58:30 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\n if (geojson.coordinates[2]) {\n result.z = geojson.coordinates[2];\n }\n\n result.spatialReference = spatialReference;\n break;\n\n case 'MultiPoint':\n result.points = geojson.coordinates.slice(0);\n\n if (geojson.coordinates[0][2]) {\n result.hasZ = true;\n }\n\n result.spatialReference = spatialReference;\n break;\n\n case 'LineString':\n result.paths = [geojson.coordinates.slice(0)];\n\n if (geojson.coordinates[0][2]) {\n result.hasZ = true;\n }\n\n result.spatialReference = spatialReference;\n break;\n\n case 'MultiLineString':\n result.paths = geojson.coordinates.slice(0);\n\n if (geojson.coordinates[0][0][2]) {\n result.hasZ = true;\n }\n\n result.spatialReference = spatialReference;\n break;\n\n case 'Polygon':\n result.rings = orientRings(geojson.coordinates.slice(0));\n\n if (geojson.coordinates[0][0][2]) {\n result.hasZ = true;\n }\n\n result.spatialReference = spatialReference;\n break;\n\n case 'MultiPolygon':\n result.rings = flattenMultiPolygonRings(geojson.coordinates.slice(0));\n\n if (geojson.coordinates[0][0][0][2]) {\n result.hasZ = true;\n }\n\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 IExtent,\n ISpatialReference,\n IPoint\n} from \"@esri/arcgis-rest-request\";\n\nimport { ARCGIS_ONLINE_GEOCODING_URL, IEndpointOptions } from \"./helpers.js\";\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 *\n * ```js\n * import { suggest, geocode } from '@esri/arcgis-rest-geocoding';\n *\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.js\";\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, IPoint, ILocation } from \"@esri/arcgis-rest-request\";\n\nimport { ARCGIS_ONLINE_GEOCODING_URL, IEndpointOptions } from \"./helpers.js\";\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, ISpatialReference, IPoint } from \"@esri/arcgis-rest-request\";\n\nimport {\n ARCGIS_ONLINE_BULK_GEOCODING_URL,\n IEndpointOptions\n} from \"./helpers.js\";\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":[],"mappings":";;;;;;;AAAA;;AAKA;MACa,2BAA2B,GACtC,2EAA2E;MAChE,gCAAgC,GAC3C,uEAAuE;AAkBzE;;;;;;;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AC,QAAQ;QACd,IAAI,OAAO,CAAC,WAAW,EAAE;YACvB,OAAO,QAAQ,CAAC;SACjB;QACD,MAAM,EAAE,GAAG,QAAQ,CAAC,gBAAgB,CAAC;QACrC,QAAQ,CAAC,SAAS,CAAC,OAAO,CAAC,UAAU,OAA6B;YAChE,IAAI,OAAO,CAAC,QAAQ,EAAE;gBACpB,OAAO,CAAC,QAAQ,CAAC,gBAAgB,GAAG,EAAE,CAAC;aACxC;SACF,CAAC,CAAC;QACH,OAAO,QAAQ,CAAC;KACjB,CAAC,CAAC;AACL;;;;"}
|
|
1
|
+
{"version":3,"file":"geocoding.esm.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.7 - MIT\n* Copyright (c) 2012-2021 Environmental Systems Research Institute, Inc.\n* Thu Jul 22 2021 13:58:30 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\n if (geojson.coordinates[2]) {\n result.z = geojson.coordinates[2];\n }\n\n result.spatialReference = spatialReference;\n break;\n\n case 'MultiPoint':\n result.points = geojson.coordinates.slice(0);\n\n if (geojson.coordinates[0][2]) {\n result.hasZ = true;\n }\n\n result.spatialReference = spatialReference;\n break;\n\n case 'LineString':\n result.paths = [geojson.coordinates.slice(0)];\n\n if (geojson.coordinates[0][2]) {\n result.hasZ = true;\n }\n\n result.spatialReference = spatialReference;\n break;\n\n case 'MultiLineString':\n result.paths = geojson.coordinates.slice(0);\n\n if (geojson.coordinates[0][0][2]) {\n result.hasZ = true;\n }\n\n result.spatialReference = spatialReference;\n break;\n\n case 'Polygon':\n result.rings = orientRings(geojson.coordinates.slice(0));\n\n if (geojson.coordinates[0][0][2]) {\n result.hasZ = true;\n }\n\n result.spatialReference = spatialReference;\n break;\n\n case 'MultiPolygon':\n result.rings = flattenMultiPolygonRings(geojson.coordinates.slice(0));\n\n if (geojson.coordinates[0][0][0][2]) {\n result.hasZ = true;\n }\n\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 IExtent,\n ISpatialReference,\n IPoint\n} from \"@esri/arcgis-rest-request\";\n\nimport { ARCGIS_ONLINE_GEOCODING_URL, IEndpointOptions } from \"./helpers.js\";\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 *\n * ```js\n * import { suggest, geocode } from '@esri/arcgis-rest-geocoding';\n *\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 * 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 *\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 *\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.js\";\n\nexport interface ISuggestResponse {\n suggestions: Array<{\n text: string;\n magicKey: string;\n isCollection: boolean;\n }>;\n}\n\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 * ```js\n * import { suggest } from '@esri/arcgis-rest-geocoding';\n * //\n * suggest(\"Starb\")\n * .then(response) // response.text === \"Starbucks\"\n * ```\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 {\n request,\n cleanUrl,\n IPoint,\n ILocation\n} from \"@esri/arcgis-rest-request\";\n\nimport { ARCGIS_ONLINE_GEOCODING_URL, IEndpointOptions } from \"./helpers.js\";\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 * Used to determine the address of a [location](https://developers.arcgis.com/rest/geocode/api-reference/geocoding-reverse-geocode.htm).\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 *\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 {\n request,\n cleanUrl,\n ISpatialReference,\n IPoint\n} from \"@esri/arcgis-rest-request\";\n\nimport {\n ARCGIS_ONLINE_BULK_GEOCODING_URL,\n IEndpointOptions\n} from \"./helpers.js\";\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 * Used to geocode a [batch](https://developers.arcgis.com/rest/geocode/api-reference/geocoding-geocode-addresses.htm) of addresses.\n *\n * ```js\n * import { bulkGeocode } from '@esri/arcgis-rest-geocoding';\n * import { ApplicationCredentialsManager } from '@esri/arcgis-rest-request';\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 *\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":[],"mappings":";;;;;;;AAAA;;AAKA;MACa,2BAA2B,GACtC,2EAA2E;MAChE,gCAAgC,GAC3C,uEAAuE;AAkBzE;;;;;;;;;;;;;;;SAegB,iBAAiB,CAC/B,cAAiC;IAEjC,MAAM,GAAG,GACP,CAAC,cAAc,IAAI,cAAc,CAAC,QAAQ,KAAK,2BAA2B,CAAC;IAE7E,MAAM,OAAO,mBACX,UAAU,EAAE,KAAK,EACjB,YAAY,EAAE,IAAI,IACf,cAAc,CAClB,CAAC;IAEF,OAAO,OAAO,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;AAC/B;;ACvDA;AACA;AAC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ACxC;SACF,CAAC,CAAC;QACH,OAAO,QAAQ,CAAC;KACjB,CAAC,CAAC;AACL;;;;"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/* @preserve
|
|
2
|
-
* @esri/arcgis-rest-geocoding - v4.0.0-beta.
|
|
2
|
+
* @esri/arcgis-rest-geocoding - v4.0.0-beta.5 - Apache-2.0
|
|
3
3
|
* Copyright (c) 2017-2022 Esri, Inc.
|
|
4
|
-
*
|
|
4
|
+
* Tue May 10 2022 02:53:32 GMT+0000 (Coordinated Universal Time)
|
|
5
5
|
*/
|
|
6
6
|
import{request as e,appendCustomParams as t,cleanUrl as r}from"@esri/arcgis-rest-request";const n="https://geocode-api.arcgis.com/arcgis/rest/services/World/GeocodeServer/",o="https://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer/";function i(t){const r=t&&t.endpoint||n,o=Object.assign({httpMethod:"GET",maxUrlLength:2e3},t);return e(r,o)}
|
|
7
7
|
/* @preserve
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"geocoding.esm.min.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.7 - MIT\n* Copyright (c) 2012-2021 Environmental Systems Research Institute, Inc.\n* Thu Jul 22 2021 13:58:30 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\n if (geojson.coordinates[2]) {\n result.z = geojson.coordinates[2];\n }\n\n result.spatialReference = spatialReference;\n break;\n\n case 'MultiPoint':\n result.points = geojson.coordinates.slice(0);\n\n if (geojson.coordinates[0][2]) {\n result.hasZ = true;\n }\n\n result.spatialReference = spatialReference;\n break;\n\n case 'LineString':\n result.paths = [geojson.coordinates.slice(0)];\n\n if (geojson.coordinates[0][2]) {\n result.hasZ = true;\n }\n\n result.spatialReference = spatialReference;\n break;\n\n case 'MultiLineString':\n result.paths = geojson.coordinates.slice(0);\n\n if (geojson.coordinates[0][0][2]) {\n result.hasZ = true;\n }\n\n result.spatialReference = spatialReference;\n break;\n\n case 'Polygon':\n result.rings = orientRings(geojson.coordinates.slice(0));\n\n if (geojson.coordinates[0][0][2]) {\n result.hasZ = true;\n }\n\n result.spatialReference = spatialReference;\n break;\n\n case 'MultiPolygon':\n result.rings = flattenMultiPolygonRings(geojson.coordinates.slice(0));\n\n if (geojson.coordinates[0][0][0][2]) {\n result.hasZ = true;\n }\n\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 IExtent,\n ISpatialReference,\n IPoint\n} from \"@esri/arcgis-rest-request\";\n\nimport { ARCGIS_ONLINE_GEOCODING_URL, IEndpointOptions } from \"./helpers.js\";\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 *\n * ```js\n * import { suggest, geocode } from '@esri/arcgis-rest-geocoding';\n *\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.js\";\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, IPoint, ILocation } from \"@esri/arcgis-rest-request\";\n\nimport { ARCGIS_ONLINE_GEOCODING_URL, IEndpointOptions } from \"./helpers.js\";\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, ISpatialReference, IPoint } from \"@esri/arcgis-rest-request\";\n\nimport {\n ARCGIS_ONLINE_BULK_GEOCODING_URL,\n IEndpointOptions\n} from \"./helpers.js\";\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":["ARCGIS_ONLINE_GEOCODING_URL","ARCGIS_ONLINE_BULK_GEOCODING_URL","getGeocodeService","requestOptions","url","endpoint","options","httpMethod","maxUrlLength","request","edgeIntersectsEdge","a1","a2","b1","b2","uaT","ubT","uB","ua","ub","arrayIntersectsArray","a","b","i","length","j","ringIsClockwise","ringToTest","pt2","total","rLength","pt1","coordinatesContainCoordinates","outer","inner","intersects","contains","coordinates","point","l","coordinatesContainPoint","arcgisToGeoJSON","arcgis","idAttribute","geojson","features","type","push","x","y","z","points","slice","paths","rings","outerRing","hole","outerRings","holes","r","ring","pointsEqual","polygon","reverse","uncontainedHoles","pop","contained","convertRingsToGeoJSON","xmin","ymin","xmax","ymax","geometry","attributes","properties","obj","target","hasOwnProperty","shallowClone","id","keys","key","Error","getId","err","JSON","stringify","spatialReference","wkid","console","warn","geocode","address","params","singleLine","appendCustomParams","cleanUrl","then","response","rawResponse","sr","candidates","forEach","candidate","location","extent","map","Object","assign","score","geoJson","suggest","partialText","text","reverseGeocode","coords","isLocationArray","undefined","latitude","lat","isLocation","long","longitude","join","bulkGeocode","addresses","records","authentication","locations","Promise","reject"],"mappings":";;;;;gGAMaA,EACX,2EACWC,EACX,gFAiCcC,EACdC,GAEA,MAAMC,EACHD,GAAkBA,EAAeE,UAAaL,EAE3CM,iBACJC,WAAY,MACZC,aAAc,KACXL,GAGL,OAAOM,EAAQL,EAAKE;;;;;EC9CtB,IAAII,EAAqB,SAA4BC,EAAIC,EAAIC,EAAIC,GAC/D,IAAIC,GAAOD,EAAG,GAAKD,EAAG,KAAOF,EAAG,GAAKE,EAAG,KAAOC,EAAG,GAAKD,EAAG,KAAOF,EAAG,GAAKE,EAAG,IACxEG,GAAOJ,EAAG,GAAKD,EAAG,KAAOA,EAAG,GAAKE,EAAG,KAAOD,EAAG,GAAKD,EAAG,KAAOA,EAAG,GAAKE,EAAG,IACxEI,GAAMH,EAAG,GAAKD,EAAG,KAAOD,EAAG,GAAKD,EAAG,KAAOG,EAAG,GAAKD,EAAG,KAAOD,EAAG,GAAKD,EAAG,IAE3E,GAAW,IAAPM,EAAU,CACZ,IAAIC,EAAKH,EAAME,EACXE,EAAKH,EAAMC,EAEf,GAAIC,GAAM,GAAKA,GAAM,GAAKC,GAAM,GAAKA,GAAM,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AAMC,IACN,GAAI5F,EAAQ6F,YACV,OAAOD,EAET,MAAME,EAAKF,EAASX,iBAMpB,OALAW,EAAS8B,UAAU1B,SAAQ,SAAUV,GAC/BA,EAAQY,WACVZ,EAAQY,SAASjB,iBAAmBa,MAGjCF,KAlBA+B,QAAQC,OACb"}
|
|
1
|
+
{"version":3,"file":"geocoding.esm.min.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.7 - MIT\n* Copyright (c) 2012-2021 Environmental Systems Research Institute, Inc.\n* Thu Jul 22 2021 13:58:30 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\n if (geojson.coordinates[2]) {\n result.z = geojson.coordinates[2];\n }\n\n result.spatialReference = spatialReference;\n break;\n\n case 'MultiPoint':\n result.points = geojson.coordinates.slice(0);\n\n if (geojson.coordinates[0][2]) {\n result.hasZ = true;\n }\n\n result.spatialReference = spatialReference;\n break;\n\n case 'LineString':\n result.paths = [geojson.coordinates.slice(0)];\n\n if (geojson.coordinates[0][2]) {\n result.hasZ = true;\n }\n\n result.spatialReference = spatialReference;\n break;\n\n case 'MultiLineString':\n result.paths = geojson.coordinates.slice(0);\n\n if (geojson.coordinates[0][0][2]) {\n result.hasZ = true;\n }\n\n result.spatialReference = spatialReference;\n break;\n\n case 'Polygon':\n result.rings = orientRings(geojson.coordinates.slice(0));\n\n if (geojson.coordinates[0][0][2]) {\n result.hasZ = true;\n }\n\n result.spatialReference = spatialReference;\n break;\n\n case 'MultiPolygon':\n result.rings = flattenMultiPolygonRings(geojson.coordinates.slice(0));\n\n if (geojson.coordinates[0][0][0][2]) {\n result.hasZ = true;\n }\n\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 IExtent,\n ISpatialReference,\n IPoint\n} from \"@esri/arcgis-rest-request\";\n\nimport { ARCGIS_ONLINE_GEOCODING_URL, IEndpointOptions } from \"./helpers.js\";\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 *\n * ```js\n * import { suggest, geocode } from '@esri/arcgis-rest-geocoding';\n *\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 * 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 *\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 *\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.js\";\n\nexport interface ISuggestResponse {\n suggestions: Array<{\n text: string;\n magicKey: string;\n isCollection: boolean;\n }>;\n}\n\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 * ```js\n * import { suggest } from '@esri/arcgis-rest-geocoding';\n * //\n * suggest(\"Starb\")\n * .then(response) // response.text === \"Starbucks\"\n * ```\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 {\n request,\n cleanUrl,\n IPoint,\n ILocation\n} from \"@esri/arcgis-rest-request\";\n\nimport { ARCGIS_ONLINE_GEOCODING_URL, IEndpointOptions } from \"./helpers.js\";\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 * Used to determine the address of a [location](https://developers.arcgis.com/rest/geocode/api-reference/geocoding-reverse-geocode.htm).\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 *\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 {\n request,\n cleanUrl,\n ISpatialReference,\n IPoint\n} from \"@esri/arcgis-rest-request\";\n\nimport {\n ARCGIS_ONLINE_BULK_GEOCODING_URL,\n IEndpointOptions\n} from \"./helpers.js\";\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 * Used to geocode a [batch](https://developers.arcgis.com/rest/geocode/api-reference/geocoding-geocode-addresses.htm) of addresses.\n *\n * ```js\n * import { bulkGeocode } from '@esri/arcgis-rest-geocoding';\n * import { ApplicationCredentialsManager } from '@esri/arcgis-rest-request';\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 *\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":["ARCGIS_ONLINE_GEOCODING_URL","ARCGIS_ONLINE_BULK_GEOCODING_URL","getGeocodeService","requestOptions","url","endpoint","options","httpMethod","maxUrlLength","request","edgeIntersectsEdge","a1","a2","b1","b2","uaT","ubT","uB","ua","ub","arrayIntersectsArray","a","b","i","length","j","ringIsClockwise","ringToTest","pt2","total","rLength","pt1","coordinatesContainCoordinates","outer","inner","intersects","contains","coordinates","point","l","coordinatesContainPoint","arcgisToGeoJSON","arcgis","idAttribute","geojson","features","type","push","x","y","z","points","slice","paths","rings","outerRing","hole","outerRings","holes","r","ring","pointsEqual","polygon","reverse","uncontainedHoles","pop","contained","convertRingsToGeoJSON","xmin","ymin","xmax","ymax","geometry","attributes","properties","obj","target","hasOwnProperty","shallowClone","id","keys","key","Error","getId","err","JSON","stringify","spatialReference","wkid","console","warn","geocode","address","params","singleLine","appendCustomParams","cleanUrl","then","response","rawResponse","sr","candidates","forEach","candidate","location","extent","map","Object","assign","score","geoJson","suggest","partialText","text","reverseGeocode","coords","isLocationArray","undefined","latitude","lat","isLocation","long","longitude","join","bulkGeocode","addresses","records","authentication","locations","Promise","reject"],"mappings":";;;;;gGAMaA,EACX,2EACWC,EACX,gFAiCcC,EACdC,GAEA,MAAMC,EACHD,GAAkBA,EAAeE,UAAaL,EAE3CM,iBACJC,WAAY,MACZC,aAAc,KACXL,GAGL,OAAOM,EAAQL,EAAKE;;;;;EC9CtB,IAAII,EAAqB,SAA4BC,EAAIC,EAAIC,EAAIC,GAC/D,IAAIC,GAAOD,EAAG,GAAKD,EAAG,KAAOF,EAAG,GAAKE,EAAG,KAAOC,EAAG,GAAKD,EAAG,KAAOF,EAAG,GAAKE,EAAG,IACxEG,GAAOJ,EAAG,GAAKD,EAAG,KAAOA,EAAG,GAAKE,EAAG,KAAOD,EAAG,GAAKD,EAAG,KAAOA,EAAG,GAAKE,EAAG,IACxEI,GAAMH,EAAG,GAAKD,EAAG,KAAOD,EAAG,GAAKD,EAAG,KAAOG,EAAG,GAAKD,EAAG,KAAOD,EAAG,GAAKD,EAAG,IAE3E,GAAW,IAAPM,EAAU,CACZ,IAAIC,EAAKH,EAAME,EACXE,EAAKH,EAAMC,EAEf,GAAIC,GAAM,GAAKA,GAAM,GAAKC,GAAM,GAAKA,GAAM,EACzC,OAAO,EAIX,OAAO,GAsBLC,EAAuB,SAA8BC,EAAGC,GAC1D,IAAK,IAAIC,EAAI,EAAGA,EAAIF,EAAEG,OAAS,EAAGD,IAChC,IAAK,IAAIE,EAAI,EAAGA,EAAIH,EAAEE,OAAS,EAAGC,IAChC,GAAIf,EAAmBW,EAAEE,GAAIF,EAAEE,EAAI,GAAID,EAAEG,GAAIH,EAAEG,EAAI,IACjD,OAAO,EAKb,OAAO,GAgBLC,EAAkB,SAAyBC,GAO7C,IANA,IAIIC,EAJAC,EAAQ,EACRN,EAAI,EACJO,EAAUH,EAAWH,OACrBO,EAAMJ,E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4
|
-
*
|
|
4
|
+
* Tue May 10 2022 02:53:32 GMT+0000 (Coordinated Universal Time)
|
|
5
5
|
*/
|
|
6
6
|
(function (global, factory) {
|
|
7
7
|
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@esri/arcgis-rest-request')) :
|
|
@@ -327,14 +327,16 @@
|
|
|
327
327
|
/* Copyright (c) 2017-2018 Environmental Systems Research Institute, Inc.
|
|
328
328
|
* Apache-2.0 */
|
|
329
329
|
/**
|
|
330
|
-
*
|
|
330
|
+
* 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.
|
|
331
|
+
*
|
|
332
|
+
* ```js
|
|
331
333
|
* import { geocode } from '@esri/arcgis-rest-geocoding';
|
|
332
|
-
*
|
|
334
|
+
*
|
|
333
335
|
* geocode("LAX")
|
|
334
336
|
* .then((response) => {
|
|
335
337
|
* response.candidates[0].location; // => { x: -118.409, y: 33.943, spatialReference: ... }
|
|
336
338
|
* });
|
|
337
|
-
*
|
|
339
|
+
*
|
|
338
340
|
* geocode({
|
|
339
341
|
* address: "1600 Pennsylvania Ave",
|
|
340
342
|
* postal: 20500,
|
|
@@ -344,7 +346,7 @@
|
|
|
344
346
|
* response.candidates[1].location; // => { x: -77.036533, y: 38.898719, spatialReference: ... }
|
|
345
347
|
* });
|
|
346
348
|
* ```
|
|
347
|
-
*
|
|
349
|
+
*
|
|
348
350
|
* @param address String representing the address or point of interest or RequestOptions to pass to the endpoint.
|
|
349
351
|
* @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.
|
|
350
352
|
*/
|
|
@@ -409,13 +411,14 @@
|
|
|
409
411
|
/* Copyright (c) 2017-2018 Environmental Systems Research Institute, Inc.
|
|
410
412
|
* Apache-2.0 */
|
|
411
413
|
/**
|
|
414
|
+
* Used to return a placename [suggestion](https://developers.arcgis.com/rest/geocode/api-reference/geocoding-suggest.htm) for a partial string.
|
|
415
|
+
*
|
|
412
416
|
* ```js
|
|
413
417
|
* import { suggest } from '@esri/arcgis-rest-geocoding';
|
|
414
418
|
* //
|
|
415
419
|
* suggest("Starb")
|
|
416
420
|
* .then(response) // response.text === "Starbucks"
|
|
417
421
|
* ```
|
|
418
|
-
* Used to return a placename [suggestion](https://developers.arcgis.com/rest/geocode/api-reference/geocoding-suggest.htm) for a partial string.
|
|
419
422
|
*
|
|
420
423
|
* @param requestOptions - Options for the request including authentication and other optional parameters.
|
|
421
424
|
* @returns A Promise that will resolve with the data from the response.
|
|
@@ -437,6 +440,8 @@
|
|
|
437
440
|
coords.lat !== undefined);
|
|
438
441
|
}
|
|
439
442
|
/**
|
|
443
|
+
* Used to determine the address of a [location](https://developers.arcgis.com/rest/geocode/api-reference/geocoding-reverse-geocode.htm).
|
|
444
|
+
*
|
|
440
445
|
* ```js
|
|
441
446
|
* import { reverseGeocode } from '@esri/arcgis-rest-geocoding';
|
|
442
447
|
* //
|
|
@@ -450,7 +455,6 @@
|
|
|
450
455
|
* reverseGeocode({ x: -118.409, y: 33.9425 }) // wgs84 is assumed
|
|
451
456
|
* reverseGeocode({ x: -13181226, y: 4021085, spatialReference: { wkid: 3857 })
|
|
452
457
|
* ```
|
|
453
|
-
* Used to determine the address of a [location](https://developers.arcgis.com/rest/geocode/api-reference/geocoding-reverse-geocode.htm).
|
|
454
458
|
*
|
|
455
459
|
* @param coordinates - the location you'd like to associate an address with.
|
|
456
460
|
* @param requestOptions - Additional options for the request including authentication.
|
|
@@ -479,21 +483,22 @@
|
|
|
479
483
|
/* Copyright (c) 2017-2018 Environmental Systems Research Institute, Inc.
|
|
480
484
|
* Apache-2.0 */
|
|
481
485
|
/**
|
|
486
|
+
* Used to geocode a [batch](https://developers.arcgis.com/rest/geocode/api-reference/geocoding-geocode-addresses.htm) of addresses.
|
|
487
|
+
*
|
|
482
488
|
* ```js
|
|
483
489
|
* import { bulkGeocode } from '@esri/arcgis-rest-geocoding';
|
|
484
|
-
* import {
|
|
485
|
-
*
|
|
490
|
+
* import { ApplicationCredentialsManager } from '@esri/arcgis-rest-request';
|
|
491
|
+
*
|
|
486
492
|
* const addresses = [
|
|
487
493
|
* { "OBJECTID": 1, "SingleLine": "380 New York Street 92373" },
|
|
488
494
|
* { "OBJECTID": 2, "SingleLine": "1 World Way Los Angeles 90045" }
|
|
489
495
|
* ];
|
|
490
|
-
*
|
|
496
|
+
*
|
|
491
497
|
* bulkGeocode({ addresses, authentication: session })
|
|
492
498
|
* .then((response) => {
|
|
493
499
|
* response.locations[0].location; // => { x: -117, y: 34, spatialReference: { wkid: 4326 } }
|
|
494
500
|
* });
|
|
495
501
|
* ```
|
|
496
|
-
* Used to geocode a [batch](https://developers.arcgis.com/rest/geocode/api-reference/geocoding-geocode-addresses.htm) of addresses.
|
|
497
502
|
*
|
|
498
503
|
* @param requestOptions - Request options to pass to the geocoder, including an array of addresses and authentication session.
|
|
499
504
|
* @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.
|