@esri/arcgis-rest-geocoding 4.0.2 → 4.0.4-alpha.1
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/README.md +5 -8
- package/dist/bundled/geocoding.esm.js +9 -5
- package/dist/bundled/geocoding.esm.js.map +1 -1
- package/dist/bundled/geocoding.esm.min.js +5 -5
- package/dist/bundled/geocoding.esm.min.js.map +1 -1
- package/dist/bundled/geocoding.umd.js +8 -4
- package/dist/bundled/geocoding.umd.js.map +1 -1
- package/dist/bundled/geocoding.umd.min.js +4 -4
- package/dist/bundled/geocoding.umd.min.js.map +1 -1
- package/dist/cjs/bulk.js.map +1 -1
- package/dist/cjs/geocode.js +5 -1
- package/dist/cjs/geocode.js.map +1 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/bulk.d.ts +2 -2
- package/dist/esm/bulk.js.map +1 -1
- package/dist/esm/geocode.d.ts +3 -3
- package/dist/esm/geocode.js +6 -2
- package/dist/esm/geocode.js.map +1 -1
- package/dist/esm/index.js.map +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
[![npm version][npm-img]][npm-url]
|
|
2
|
-
[![build status][travis-img]][travis-url]
|
|
3
2
|
[![gzip bundle size][gzip-image]][npm-url]
|
|
4
3
|
[![Coverage Status][coverage-img]][coverage-url]
|
|
5
4
|
[](https://raw.githubusercontent.com/Esri/arcgis-rest-js/master/LICENSE)
|
|
6
5
|
|
|
7
6
|
[npm-img]: https://img.shields.io/npm/v/@esri/arcgis-rest-geocoding.svg?style=flat-square
|
|
8
7
|
[npm-url]: https://www.npmjs.com/package/@esri/arcgis-rest-geocoding
|
|
9
|
-
[travis-img]: https://img.shields.io/travis/Esri/arcgis-rest-js/master.svg?style=flat-square
|
|
10
|
-
[travis-url]: https://travis-ci.org/Esri/arcgis-rest-js
|
|
11
8
|
[gzip-image]: https://img.badgesize.io/https://unpkg.com/@esri/arcgis-rest-geocoding/dist/bundled/geocoding.umd.min.js?compression=gzip
|
|
12
9
|
[coverage-img]: https://codecov.io/gh/Esri/arcgis-rest-js/branch/master/graph/badge.svg
|
|
13
10
|
[coverage-url]: https://codecov.io/gh/Esri/arcgis-rest-js
|
|
@@ -32,15 +29,15 @@ geocode("LAX").then((response) => {
|
|
|
32
29
|
});
|
|
33
30
|
```
|
|
34
31
|
|
|
35
|
-
### [API Reference](https://
|
|
32
|
+
### [API Reference](https://developers.arcgis.com/arcgis-rest-js/api-reference/arcgis-rest-geocoding/)
|
|
36
33
|
|
|
37
|
-
- [`geocode("1 World Way Los Angeles 90045")`](https://
|
|
34
|
+
- [`geocode("1 World Way Los Angeles 90045")`](https://developers.arcgis.com/arcgis-rest-js/api-reference/arcgis-rest-geocoding/geocode/)
|
|
38
35
|
|
|
39
|
-
- [`suggest("Starb")`](https://
|
|
36
|
+
- [`suggest("Starb")`](https://developers.arcgis.com/arcgis-rest-js/api-reference/arcgis-rest-geocoding/suggest/)
|
|
40
37
|
|
|
41
|
-
- [`reverseGeocode([-118.409,33.943 ])`](https://
|
|
38
|
+
- [`reverseGeocode([-118.409,33.943 ])`](https://developers.arcgis.com/arcgis-rest-js/api-reference/arcgis-rest-geocoding/reverseGeocode/)
|
|
42
39
|
|
|
43
|
-
- [`bulkGeocode()`](https://
|
|
40
|
+
- [`bulkGeocode()`](https://developers.arcgis.com/arcgis-rest-js/api-reference/arcgis-rest-geocoding/bulkGeocode/)
|
|
44
41
|
|
|
45
42
|
### Issues
|
|
46
43
|
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/* @preserve
|
|
2
|
-
* @esri/arcgis-rest-geocoding - v4.0.
|
|
3
|
-
* Copyright (c) 2017-
|
|
4
|
-
*
|
|
2
|
+
* @esri/arcgis-rest-geocoding - v4.0.3 - Apache-2.0
|
|
3
|
+
* Copyright (c) 2017-2025 Esri, Inc.
|
|
4
|
+
* Mon May 12 2025 21:29:23 GMT+0000 (Coordinated Universal Time)
|
|
5
5
|
*/
|
|
6
|
-
import { request, appendCustomParams, cleanUrl } from '@esri/arcgis-rest-request';
|
|
6
|
+
import { request, appendCustomParams, warn, cleanUrl } from '@esri/arcgis-rest-request';
|
|
7
7
|
|
|
8
8
|
/* Copyright (c) 2017 Environmental Systems Research Institute, Inc.
|
|
9
9
|
* Apache-2.0 */
|
|
@@ -335,7 +335,7 @@ var arcgisToGeoJSON = function arcgisToGeoJSON(arcgis, idAttribute) {
|
|
|
335
335
|
*
|
|
336
336
|
* geocode({
|
|
337
337
|
* address: "1600 Pennsylvania Ave",
|
|
338
|
-
* postal: 20500,
|
|
338
|
+
* postal: "20500",
|
|
339
339
|
* countryCode: "USA"
|
|
340
340
|
* })
|
|
341
341
|
* .then((response) => {
|
|
@@ -370,6 +370,10 @@ function geocode(address) {
|
|
|
370
370
|
"outFields",
|
|
371
371
|
"magicKey"
|
|
372
372
|
], { params: Object.assign({}, address.params) });
|
|
373
|
+
if (options.params.postal && typeof options.params.postal === "number") {
|
|
374
|
+
warn("The postal code should be a string. " +
|
|
375
|
+
"Issues can arise when using it as a number, especially if they start with zero.");
|
|
376
|
+
}
|
|
373
377
|
}
|
|
374
378
|
// add spatialReference property to individual matches
|
|
375
379
|
return request(`${cleanUrl(endpoint)}/findAddressCandidates`, options).then((response) => {
|
|
@@ -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 * 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;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI,kBAAkB,GAAG,SAAS,kBAAkB,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE;AACrE,EAAE,IAAI,GAAG,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;AAClF,EAAE,IAAI,GAAG,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;AAClF,EAAE,IAAI,EAAE,GAAG,CAAC,EAAE,CAAC,CA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K,gCAAgC,EACrD;QACA,OAAO,OAAO,CAAC,MAAM,CACnB,iEAAiE,CAClE,CAAC;KACH;IAED,OAAO,OAAO,CACZ,GAAG,QAAQ,CAAC,OAAO,CAAC,QAAQ,CAAC,mBAAmB,EAChD,OAAO,CACR,CAAC,IAAI,CAAC,CAAC,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 warn\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?: string | number;\n postalExt?: string | 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 if (options.params.postal && typeof options.params.postal === \"number\") {\n warn(\n \"The postal code should be a string. \" +\n \"Issues can arise when using it as a number, especially if they start with zero.\"\n );\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?: string | number;\n postalExt?: string | 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,uE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gCAAgC,EACrD;QACA,OAAO,OAAO,CAAC,MAAM,CACnB,iEAAiE,CAClE,CAAC;KACH;IAED,OAAO,OAAO,CACZ,GAAG,QAAQ,CAAC,OAAO,CAAC,QAAQ,CAAC,mBAAmB,EAChD,OAAO,CACR,CAAC,IAAI,CAAC,CAAC,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,12 +1,12 @@
|
|
|
1
1
|
/* @preserve
|
|
2
|
-
* @esri/arcgis-rest-geocoding - v4.0.
|
|
3
|
-
* Copyright (c) 2017-
|
|
4
|
-
*
|
|
2
|
+
* @esri/arcgis-rest-geocoding - v4.0.3 - Apache-2.0
|
|
3
|
+
* Copyright (c) 2017-2025 Esri, Inc.
|
|
4
|
+
* Mon May 12 2025 21:29:23 GMT+0000 (Coordinated Universal Time)
|
|
5
5
|
*/
|
|
6
|
-
import{request as e,appendCustomParams as t,cleanUrl as
|
|
6
|
+
import{request as e,appendCustomParams as t,warn as r,cleanUrl as n}from"@esri/arcgis-rest-request";const o="https://geocode-api.arcgis.com/arcgis/rest/services/World/GeocodeServer/",s="https://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer/";function a(t){const r=t&&t.endpoint||o,n=Object.assign({httpMethod:"GET",maxUrlLength:2e3},t);return e(r,n)}
|
|
7
7
|
/* @preserve
|
|
8
8
|
* @terraformer/arcgis - v2.0.7 - MIT
|
|
9
9
|
* Copyright (c) 2012-2021 Environmental Systems Research Institute, Inc.
|
|
10
10
|
* Thu Jul 22 2021 13:58:30 GMT-0700 (Pacific Daylight Time)
|
|
11
|
-
*/var
|
|
11
|
+
*/var i=function(e,t,r,n){var o=(n[0]-r[0])*(e[1]-r[1])-(n[1]-r[1])*(e[0]-r[0]),s=(t[0]-e[0])*(e[1]-r[1])-(t[1]-e[1])*(e[0]-r[0]),a=(n[1]-r[1])*(t[0]-e[0])-(n[0]-r[0])*(t[1]-e[1]);if(0!==a){var i=o/a,c=s/a;if(i>=0&&i<=1&&c>=0&&c<=1)return!0}return!1},c=function(e,t){for(var r=0;r<e.length-1;r++)for(var n=0;n<t.length-1;n++)if(i(e[r],e[r+1],t[n],t[n+1]))return!0;return!1},u=function(e){for(var t,r=0,n=0,o=e.length,s=e[n];n<o-1;n++)r+=((t=e[n+1])[0]-s[0])*(t[1]+s[1]),s=t;return r>=0},p=function(e,t){var r=c(e,t),n=function(e,t){for(var r=!1,n=-1,o=e.length,s=o-1;++n<o;s=n)(e[n][1]<=t[1]&&t[1]<e[s][1]||e[s][1]<=t[1]&&t[1]<e[n][1])&&t[0]<(e[s][0]-e[n][0])*(t[1]-e[n][1])/(e[s][1]-e[n][1])+e[n][0]&&(r=!r);return r}(e,t[0]);return!(r||!n)},l=function e(t,r){var n={};if(t.features){n.type="FeatureCollection",n.features=[];for(var o=0;o<t.features.length;o++)n.features.push(e(t.features[o],r))}if("number"==typeof t.x&&"number"==typeof t.y&&(n.type="Point",n.coordinates=[t.x,t.y],"number"==typeof t.z&&n.coordinates.push(t.z)),t.points&&(n.type="MultiPoint",n.coordinates=t.points.slice(0)),t.paths&&(1===t.paths.length?(n.type="LineString",n.coordinates=t.paths[0].slice(0)):(n.type="MultiLineString",n.coordinates=t.paths.slice(0))),t.rings&&(n=function(e){for(var t,r,n,o,s=[],a=[],i=0;i<e.length;i++){var l=(function(e,t){for(var r=0;r<e.length;r++)if(e[r]!==t[r])return!1;return!0}((o=e[i].slice(0))[0],o[o.length-1])||o.push(o[0]),o);if(!(l.length<4))if(u(l)){var f=[l.slice().reverse()];s.push(f)}else a.push(l.slice().reverse())}for(var d=[];a.length;){n=a.pop();var g=!1;for(t=s.length-1;t>=0;t--)if(r=s[t][0],p(r,n)){s[t].push(n),g=!0;break}g||d.push(n)}for(;d.length;){n=d.pop();var m=!1;for(t=s.length-1;t>=0;t--)if(r=s[t][0],c(r,n)){s[t].push(n),m=!0;break}m||s.push([n.reverse()])}return 1===s.length?{type:"Polygon",coordinates:s[0]}:{type:"MultiPolygon",coordinates:s}}(t.rings.slice(0))),"number"==typeof t.xmin&&"number"==typeof t.ymin&&"number"==typeof t.xmax&&"number"==typeof t.ymax&&(n.type="Polygon",n.coordinates=[[[t.xmax,t.ymax],[t.xmin,t.ymax],[t.xmin,t.ymin],[t.xmax,t.ymin],[t.xmax,t.ymax]]]),(t.geometry||t.attributes)&&(n.type="Feature",n.geometry=t.geometry?e(t.geometry):null,n.properties=t.attributes?function(e){var t={};for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r]);return t}(t.attributes):null,t.attributes))try{n.id=function(e,t){for(var r=t?[t,"OBJECTID","FID"]:["OBJECTID","FID"],n=0;n<r.length;n++){var o=r[n];if(o in e&&("string"==typeof e[o]||"number"==typeof e[o]))return e[o]}throw Error("No valid id attribute found")}(t.attributes,r)}catch(e){}return JSON.stringify(n.geometry)===JSON.stringify({})&&(n.geometry=null),t.spatialReference&&t.spatialReference.wkid&&4326!==t.spatialReference.wkid&&console.warn("Object converted in non-standard crs - "+JSON.stringify(t.spatialReference)),n};function f(s){let a,i={};return"string"==typeof s?(i.params={singleLine:s},a=o):(a=s.endpoint||o,i=t(s,["singleLine","address","address2","address3","neighborhood","city","subregion","region","postal","postalExt","countryCode","outFields","magicKey"],{params:Object.assign({},s.params)}),i.params.postal&&"number"==typeof i.params.postal&&r("The postal code should be a string. Issues can arise when using it as a number, especially if they start with zero.")),e(`${n(a)}/findAddressCandidates`,i).then((e=>{if("string"!=typeof s&&s.rawResponse)return e;const t=e.spatialReference;if(e.candidates.forEach((function(e){e.location.spatialReference=t,e.extent&&(e.extent.spatialReference=t)})),4326===t.wkid){const t=e.candidates.map((e=>({type:"Feature",geometry:l(e.location),properties:Object.assign({address:e.address,score:e.score},e.attributes)})));e.geoJson={type:"FeatureCollection",features:t}}return e}))}function d(t,r){const s=Object.assign({endpoint:o,params:{}},r);return s.params.text=t,e(`${n(s.endpoint)}/suggest`,s)}function g(t,r){const s=Object.assign({endpoint:o,params:{}},r);return!function(e){return 2===e.length||3===e.length}(t)?!function(e){return void 0!==e.latitude||void 0!==e.lat}(t)?s.params.location=t:(t.lat&&(s.params.location=t.long+","+t.lat),t.latitude&&(s.params.location=t.longitude+","+t.latitude)):s.params.location=t.join(),e(`${n(s.endpoint)}/reverseGeocode`,s)}function m(t){const r=Object.assign({endpoint:s,params:{}},t);return r.params.addresses={records:t.addresses.map((e=>({attributes:e})))},t.authentication||r.endpoint!==s?e(`${n(r.endpoint)}/geocodeAddresses`,r).then((e=>{if(r.rawResponse)return e;const t=e.spatialReference;return e.locations.forEach((function(e){e.location&&(e.location.spatialReference=t)})),e})):Promise.reject("bulk geocoding using the ArcGIS service requires authentication")}export{s as ARCGIS_ONLINE_BULK_GEOCODING_URL,o as ARCGIS_ONLINE_GEOCODING_URL,m as bulkGeocode,f as geocode,a as getGeocodeService,g as reverseGeocode,d as suggest};
|
|
12
12
|
//# sourceMappingURL=geocoding.esm.min.js.map
|
|
@@ -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 * 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,GA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BlH,EAAQ,GAAGuF,EAAS1F,EAAQD,2BAA4BC,YCXjDsH,EACdzH,GAEA,MAAMG,iBACJD,SAAUJ,EACV4F,OAAQ,IACL1F,GAUL,OAPAG,EAAQuF,OAAOgC,UAAY,CACzBC,QAAS3H,EAAe0H,UAAUnB,KAAKd,IAC9B,CAAEnB,WAAYmB,OAMtBzF,EAAe4H,gBAChBzH,EAAQD,WAAaJ,EAOhBQ,EACL,GAAGuF,EAAS1F,EAAQD,6BACpBC,GACA2F,MAAMC,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 warn\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?: string | number;\n postalExt?: string | 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 if (options.params.postal && typeof options.params.postal === \"number\") {\n warn(\n \"The postal code should be a string. \" +\n \"Issues can arise when using it as a number, especially if they start with zero.\"\n );\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?: string | number;\n postalExt?: string | 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","postal","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":";;;;;0GAMaA,EACX,2EACWC,EACX,gFAiCcC,EACdC,GAEA,MAAMC,EACHD,GAAkBA,EAAeE,UAAaL,EAE3CM,iBACJC,WAAY,MACZC,aAAc,KACXL,GAGL,OAAOM,EAAQL,EAAKE,EACtB;;;;;EC/CA,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,GAAI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4F,OAAQ,IACL1F,GAUL,OAPAG,EAAQuF,OAAOiC,UAAY,CACzBC,QAAS5H,EAAe2H,UAAUnB,KAAKf,IAC9B,CAAEnB,WAAYmB,OAMtBzF,EAAe6H,gBAChB1H,EAAQD,WAAaJ,EAOhBQ,EACL,GAAGwF,EAAS3F,EAAQD,6BACpBC,GACA4F,MAAMC,IACN,GAAI7F,EAAQ8F,YACV,OAAOD,EAET,MAAME,EAAKF,EAASZ,iBAMpB,OALAY,EAAS8B,UAAU1B,SAAQ,SAAUX,GAC/BA,EAAQa,WACVb,EAAQa,SAASlB,iBAAmBc,MAGjCF,CAAQ,IAlBR+B,QAAQC,OACb,kEAmBN"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/* @preserve
|
|
2
|
-
* @esri/arcgis-rest-geocoding - v4.0.
|
|
3
|
-
* Copyright (c) 2017-
|
|
4
|
-
*
|
|
2
|
+
* @esri/arcgis-rest-geocoding - v4.0.3 - Apache-2.0
|
|
3
|
+
* Copyright (c) 2017-2025 Esri, Inc.
|
|
4
|
+
* Mon May 12 2025 21:29:23 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')) :
|
|
@@ -339,7 +339,7 @@
|
|
|
339
339
|
*
|
|
340
340
|
* geocode({
|
|
341
341
|
* address: "1600 Pennsylvania Ave",
|
|
342
|
-
* postal: 20500,
|
|
342
|
+
* postal: "20500",
|
|
343
343
|
* countryCode: "USA"
|
|
344
344
|
* })
|
|
345
345
|
* .then((response) => {
|
|
@@ -374,6 +374,10 @@
|
|
|
374
374
|
"outFields",
|
|
375
375
|
"magicKey"
|
|
376
376
|
], { params: Object.assign({}, address.params) });
|
|
377
|
+
if (options.params.postal && typeof options.params.postal === "number") {
|
|
378
|
+
arcgisRestRequest.warn("The postal code should be a string. " +
|
|
379
|
+
"Issues can arise when using it as a number, especially if they start with zero.");
|
|
380
|
+
}
|
|
377
381
|
}
|
|
378
382
|
// add spatialReference property to individual matches
|
|
379
383
|
return arcgisRestRequest.request(`${arcgisRestRequest.cleanUrl(endpoint)}/findAddressCandidates`, options).then((response) => {
|