@esri/arcgis-rest-routing 3.4.1 → 4.0.0-beta.2
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 +4 -5
- package/dist/bundled/routing.esm.js +736 -0
- package/dist/bundled/routing.esm.js.map +1 -0
- package/dist/bundled/routing.esm.min.js +12 -0
- package/dist/bundled/routing.esm.min.js.map +1 -0
- package/dist/bundled/routing.umd.js +754 -0
- package/dist/bundled/routing.umd.js.map +1 -0
- package/dist/bundled/routing.umd.min.js +12 -0
- package/dist/bundled/routing.umd.min.js.map +1 -0
- package/dist/{node → cjs}/closestFacility.js +18 -18
- package/dist/cjs/closestFacility.js.map +1 -0
- package/dist/{node → cjs}/helpers.js +11 -11
- package/dist/cjs/helpers.js.map +1 -0
- package/dist/cjs/index.js +11 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/{node → cjs}/originDestinationMatrix.js +22 -23
- package/dist/cjs/originDestinationMatrix.js.map +1 -0
- package/dist/{node → cjs}/serviceArea.js +15 -16
- package/dist/cjs/serviceArea.js.map +1 -0
- package/dist/{node → cjs}/solveRoute.js +16 -17
- package/dist/cjs/solveRoute.js.map +1 -0
- package/dist/esm/closestFacility.d.ts +3 -2
- package/dist/esm/closestFacility.js +9 -9
- package/dist/esm/closestFacility.js.map +1 -1
- package/dist/esm/helpers.d.ts +1 -2
- package/dist/esm/helpers.js +15 -15
- package/dist/esm/helpers.js.map +1 -1
- package/dist/esm/index.d.ts +6 -6
- package/dist/esm/index.js +5 -5
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/originDestinationMatrix.d.ts +2 -2
- package/dist/esm/originDestinationMatrix.js +8 -9
- package/dist/esm/originDestinationMatrix.js.map +1 -1
- package/dist/esm/serviceArea.d.ts +2 -2
- package/dist/esm/serviceArea.js +8 -9
- package/dist/esm/serviceArea.js.map +1 -1
- package/dist/esm/solveRoute.d.ts +2 -2
- package/dist/esm/solveRoute.js +10 -11
- package/dist/esm/solveRoute.js.map +1 -1
- package/package.json +45 -41
- package/dist/node/closestFacility.js.map +0 -1
- package/dist/node/helpers.js.map +0 -1
- package/dist/node/index.js +0 -11
- package/dist/node/index.js.map +0 -1
- package/dist/node/originDestinationMatrix.js.map +0 -1
- package/dist/node/serviceArea.js.map +0 -1
- package/dist/node/solveRoute.js.map +0 -1
- package/dist/umd/routing.umd.js +0 -779
- package/dist/umd/routing.umd.js.map +0 -1
- package/dist/umd/routing.umd.min.js +0 -12
- package/dist/umd/routing.umd.min.js.map +0 -1
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
/* Copyright (c) 2018 Environmental Systems Research Institute, Inc.
|
|
2
2
|
* Apache-2.0 */
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { ARCGIS_ONLINE_ORIGIN_DESTINATION_MATRIX_URL, normalizeLocationsList, isFeatureSet, } from "./helpers";
|
|
3
|
+
import { request, cleanUrl, appendCustomParams } from "@esri/arcgis-rest-request";
|
|
4
|
+
import { ARCGIS_ONLINE_ORIGIN_DESTINATION_MATRIX_URL, normalizeLocationsList, isFeatureSet } from "./helpers.js";
|
|
6
5
|
import { arcgisToGeoJSON } from "@terraformer/arcgis";
|
|
7
6
|
/**
|
|
8
7
|
* ```js
|
|
@@ -29,9 +28,9 @@ import { arcgisToGeoJSON } from "@terraformer/arcgis";
|
|
|
29
28
|
* @restlink https://developers.arcgis.com/rest/network/api-reference/origin-destination-cost-matrix-synchronous-service.htm
|
|
30
29
|
*/
|
|
31
30
|
export function originDestinationMatrix(requestOptions) {
|
|
32
|
-
|
|
33
|
-
requestOptions.params =
|
|
34
|
-
|
|
31
|
+
const endpoint = requestOptions.endpoint || ARCGIS_ONLINE_ORIGIN_DESTINATION_MATRIX_URL;
|
|
32
|
+
requestOptions.params = Object.assign({ outputType: "esriNAODOutputSparseMatrix", returnOrigins: true, returnDestinations: true, returnBarriers: true, returnPolylineBarriers: true, returnPolygonBarriers: true }, requestOptions.params);
|
|
33
|
+
const options = appendCustomParams(requestOptions, [
|
|
35
34
|
"outputType",
|
|
36
35
|
"barriers",
|
|
37
36
|
"polylineBarriers",
|
|
@@ -40,7 +39,7 @@ export function originDestinationMatrix(requestOptions) {
|
|
|
40
39
|
"returnDestinations",
|
|
41
40
|
"returnBarriers",
|
|
42
41
|
"returnPolylineBarriers",
|
|
43
|
-
"returnPolygonBarriers"
|
|
42
|
+
"returnPolygonBarriers"
|
|
44
43
|
]);
|
|
45
44
|
// the SAAS service does not support anonymous requests
|
|
46
45
|
if (!requestOptions.authentication &&
|
|
@@ -72,7 +71,7 @@ export function originDestinationMatrix(requestOptions) {
|
|
|
72
71
|
options.params.barriers = normalizeLocationsList(requestOptions.barriers).join(";");
|
|
73
72
|
}
|
|
74
73
|
}
|
|
75
|
-
return request(cleanUrl(endpoint)
|
|
74
|
+
return request(`${cleanUrl(endpoint)}/solveODCostMatrix`, options).then(function (res) {
|
|
76
75
|
return cleanResponse(res, options);
|
|
77
76
|
});
|
|
78
77
|
}
|
|
@@ -104,6 +103,6 @@ function cleanResponse(res, options) {
|
|
|
104
103
|
return res;
|
|
105
104
|
}
|
|
106
105
|
export default {
|
|
107
|
-
originDestinationMatrix
|
|
106
|
+
originDestinationMatrix
|
|
108
107
|
};
|
|
109
108
|
//# sourceMappingURL=originDestinationMatrix.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"originDestinationMatrix.js","sourceRoot":"","sources":["../../src/originDestinationMatrix.ts"],"names":[],"mappings":"AAAA;gBACgB;;AAEhB,OAAO,EACL,OAAO,EACP,QAAQ,EACR,kBAAkB,GAEnB,MAAM,2BAA2B,CAAC;AASnC,OAAO,EACL,2CAA2C,EAE3C,sBAAsB,EACtB,YAAY,GACb,MAAM,WAAW,CAAC;AAEnB,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAiDtD;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,UAAU,uBAAuB,CACrC,cAA+C;IAE/C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I,EAAE;QAC/D,GAAG,CAAC,QAAQ,CAAC,OAAO,GAAG,eAAe,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;KACtD;IAED,IACE,GAAG,CAAC,eAAe;QACnB,GAAG,CAAC,eAAe,CAAC,gBAAgB,CAAC,IAAI,KAAK,IAAI,EAClD;QACA,GAAG,CAAC,eAAe,CAAC,OAAO,GAAG,eAAe,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC;KACpE;IAED,IACE,GAAG,CAAC,gBAAgB;QACpB,GAAG,CAAC,gBAAgB,CAAC,gBAAgB,CAAC,IAAI,KAAK,IAAI,EACnD;QACA,GAAG,CAAC,gBAAgB,CAAC,OAAO,GAAG,eAAe,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC;KACtE;IAED,OAAO,GAAG,CAAC;AACb,CAAC;AAED,eAAe;IACb,uBAAuB,yBAAA;CACxB,CAAC"}
|
|
1
|
+
{"version":3,"file":"originDestinationMatrix.js","sourceRoot":"","sources":["../../src/originDestinationMatrix.ts"],"names":[],"mappings":"AAAA;gBACgB;AAEhB,OAAO,EACL,OAAO,EACP,QAAQ,EACR,kBAAkB,EAKnB,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EACL,2CAA2C,EAE3C,sBAAsB,EACtB,YAAY,EACb,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAiDtD;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,UAAU,uBAAuB,CACrC,cAA+C;IAE/C,MAAM,QAAQ,GACZ,cAAc,CAAC,QAAQ,IAAI,2CAA2C,CAAC;IAEzE,cAAc,CAAC,MAAM,mBACnB,UAAU,EAAE,4BAA4B,EACxC,aAAa,EAAE,IAAI,EACnB,kBAAkB,EAAE,IAAI,EACxB,cAAc,EAAE,IAAI,EACpB,sBAAsB,EAAE,IAAI,EAC5B,qBAAqB,EAAE,IAAI,IACxB,cAAc,CAAC,MAAM,CACzB,CAA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,CAAC,CAAC;KACpE;IAED,IACE,GAAG,CAAC,gBAAgB;QACpB,GAAG,CAAC,gBAAgB,CAAC,gBAAgB,CAAC,IAAI,KAAK,IAAI,EACnD;QACA,GAAG,CAAC,gBAAgB,CAAC,OAAO,GAAG,eAAe,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC;KACtE;IAED,OAAO,GAAG,CAAC;AACb,CAAC;AAED,eAAe;IACb,uBAAuB;CACxB,CAAC","sourcesContent":["/* Copyright (c) 2018 Environmental Systems Research Institute, Inc.\n * Apache-2.0 */\n\nimport {\n request,\n cleanUrl,\n appendCustomParams,\n IRequestOptions,\n ILocation, \n IPoint, \n IFeatureSet\n} from \"@esri/arcgis-rest-request\";\n\nimport {\n ARCGIS_ONLINE_ORIGIN_DESTINATION_MATRIX_URL,\n IEndpointOptions,\n normalizeLocationsList,\n isFeatureSet\n} from \"./helpers.js\";\n\nimport { arcgisToGeoJSON } from \"@terraformer/arcgis\";\n\nexport interface IOriginDestinationMatrixOptions extends IEndpointOptions {\n /**\n * Specify the starting points from which to travel to the destinations.\n */\n origins: Array<IPoint | ILocation | [number, number]> | IFeatureSet;\n /**\n * Specify the ending point locations to travel to from the origins.\n */\n destinations: Array<IPoint | ILocation | [number, number]> | IFeatureSet;\n /**\n * Specify the type of output returned by the service. Defaults to \"esriNAODOutputSparseMatrix\".\n */\n outputType?:\n | \"esriNAODOutputSparseMatrix\"\n | \"esriNAODOutputStraightLines\"\n | \"esriNAODOutputNoLines\";\n barriers?: Array<IPoint | ILocation | [number, number]> | IFeatureSet;\n polylineBarriers?: IFeatureSet;\n polygonBarriers?: IFeatureSet;\n returnOrigins?: boolean;\n returnDestinations?: boolean;\n returnBarriers?: boolean;\n returnPolylineBarriers?: boolean;\n returnPolygonBarriers?: boolean;\n}\n\ninterface IFeatureSetWithGeoJson extends IFeatureSet {\n geoJson?: any;\n}\n\nexport interface IOriginDestinationMatrixResponse {\n messages: [{ type: number; description: string }];\n /**\n * Only present if outputType is \"esriNAODOutputSparseMatrix\". Full description is available at https://developers.arcgis.com/rest/network/api-reference/origin-destination-cost-matrix-synchronous-service.htm#ESRI_SECTION2_114F8364507C4B56B780DFAD505270FB.\n */\n odCostMatrix?: any;\n /**\n * Only present if outputType is \"esriNAODOutputStraightLines\" or \"esriNAODOutputNoLines\". Includes the geometry for the straight line connecting each origin-destination pair when the outputType is \"esriNAODOutputStraightLines\".\n */\n odLines?: IFeatureSetWithGeoJson;\n origins?: IFeatureSetWithGeoJson;\n destinations?: IFeatureSetWithGeoJson;\n barriers?: IFeatureSetWithGeoJson;\n polylineBarriers?: IFeatureSetWithGeoJson;\n polygonBarriers?: IFeatureSetWithGeoJson;\n}\n\n/**\n * ```js\n * import { originDestinationMatrix } from '@esri/arcgis-rest-routing';\n * //\n * originDestinationMatrix({\n * origins: [\n * [-90.404302, 38.600621],\n * [-90.364293, 38.620427],\n * ],\n * destinations: [\n * [-90.444716, 38.635501],\n * [-90.311919, 38.633523],\n * [-90.451147, 38.581107]\n * ],\n * authentication\n * })\n * .then(response) // => { ... }\n * ```\n * Used to create an origin-destination (OD) cost matrix from multiple origins to multiple destinations. See the [REST Documentation](https://developers.arcgis.com/rest/network/api-reference/origin-destination-cost-matrix-synchronous-service.htm) for more information.\n *\n * @param requestOptions Options to pass through to the routing service.\n * @returns A Promise that will resolve with travel time and/or distance for each origin-destination pair. It returns either odLines or odCostMatrix for this information depending on the outputType you specify.\n * @restlink https://developers.arcgis.com/rest/network/api-reference/origin-destination-cost-matrix-synchronous-service.htm\n */\nexport function originDestinationMatrix(\n requestOptions: IOriginDestinationMatrixOptions\n): Promise<IOriginDestinationMatrixResponse> {\n const endpoint =\n requestOptions.endpoint || ARCGIS_ONLINE_ORIGIN_DESTINATION_MATRIX_URL;\n\n requestOptions.params = {\n outputType: \"esriNAODOutputSparseMatrix\",\n returnOrigins: true,\n returnDestinations: true,\n returnBarriers: true,\n returnPolylineBarriers: true,\n returnPolygonBarriers: true,\n ...requestOptions.params\n };\n\n const options = appendCustomParams<IOriginDestinationMatrixOptions>(\n requestOptions,\n [\n \"outputType\",\n \"barriers\",\n \"polylineBarriers\",\n \"polygonBarriers\",\n \"returnOrigins\",\n \"returnDestinations\",\n \"returnBarriers\",\n \"returnPolylineBarriers\",\n \"returnPolygonBarriers\"\n ]\n );\n\n // the SAAS service does not support anonymous requests\n if (\n !requestOptions.authentication &&\n endpoint === ARCGIS_ONLINE_ORIGIN_DESTINATION_MATRIX_URL\n ) {\n return Promise.reject(\n \"Calculating the origin-destination cost matrix using the ArcGIS service requires authentication\"\n );\n }\n\n // use a formatting helper for input params of this type: Array<IPoint | ILocation | [number, number]>\n if (isFeatureSet(requestOptions.origins)) {\n options.params.origins = requestOptions.origins;\n } else {\n options.params.origins = normalizeLocationsList(\n requestOptions.origins\n ).join(\";\");\n }\n\n if (isFeatureSet(requestOptions.destinations)) {\n options.params.destinations = requestOptions.destinations;\n } else {\n options.params.destinations = normalizeLocationsList(\n requestOptions.destinations\n ).join(\";\");\n }\n\n // optional input param that may need point geometry normalizing\n if (requestOptions.barriers) {\n if (isFeatureSet(requestOptions.barriers)) {\n options.params.barriers = requestOptions.barriers;\n } else {\n // optional point geometry barriers must be normalized, too\n // but not if provided as IFeatureSet type\n // note that optional polylineBarriers and polygonBarriers do not need to be normalized\n options.params.barriers = normalizeLocationsList(\n requestOptions.barriers\n ).join(\";\");\n }\n }\n\n return request(`${cleanUrl(endpoint)}/solveODCostMatrix`, options).then(\n function (res) {\n return cleanResponse(res, options);\n }\n );\n}\n\nfunction cleanResponse(\n res: any,\n options: IRequestOptions\n): IOriginDestinationMatrixResponse {\n // add \"geoJson\" property to each response property that is an arcgis featureSet\n\n // res.odLines only exists and only includes geometry in this condition (out of 3 possible options.params.outputType conditions)\n if (\n options.params.outputType === \"esriNAODOutputStraightLines\" &&\n res.odLines &&\n res.odLines.spatialReference.wkid === 4326\n ) {\n res.odLines.geoJson = arcgisToGeoJSON(res.odLines);\n }\n\n if (res.origins && res.origins.spatialReference.wkid === 4326) {\n res.origins.geoJson = arcgisToGeoJSON(res.origins);\n }\n\n if (res.destinations && res.destinations.spatialReference.wkid === 4326) {\n res.destinations.geoJson = arcgisToGeoJSON(res.destinations);\n }\n\n if (res.barriers && res.barriers.spatialReference.wkid === 4326) {\n res.barriers.geoJson = arcgisToGeoJSON(res.barriers);\n }\n\n if (\n res.polygonBarriers &&\n res.polygonBarriers.spatialReference.wkid === 4326\n ) {\n res.polygonBarriers.geoJson = arcgisToGeoJSON(res.polygonBarriers);\n }\n\n if (\n res.polylineBarriers &&\n res.polylineBarriers.spatialReference.wkid === 4326\n ) {\n res.polylineBarriers.geoJson = arcgisToGeoJSON(res.polylineBarriers);\n }\n\n return res;\n}\n\nexport default {\n originDestinationMatrix\n};\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ILocation, IPoint, IFeatureSet } from "@esri/arcgis-rest-
|
|
2
|
-
import { IEndpointOptions } from "./helpers";
|
|
1
|
+
import { ILocation, IPoint, IFeatureSet } from "@esri/arcgis-rest-request";
|
|
2
|
+
import { IEndpointOptions } from "./helpers.js";
|
|
3
3
|
export interface IServiceAreaOptions extends IEndpointOptions {
|
|
4
4
|
/**
|
|
5
5
|
* Specify one or more locations around which service areas are generated.
|
package/dist/esm/serviceArea.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
/* Copyright (c) 2018 Environmental Systems Research Institute, Inc.
|
|
2
2
|
* Apache-2.0 */
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { ARCGIS_ONLINE_SERVICE_AREA_URL, normalizeLocationsList, isFeatureSet, } from "./helpers";
|
|
3
|
+
import { request, cleanUrl, appendCustomParams } from "@esri/arcgis-rest-request";
|
|
4
|
+
import { ARCGIS_ONLINE_SERVICE_AREA_URL, normalizeLocationsList, isFeatureSet } from "./helpers.js";
|
|
6
5
|
import { arcgisToGeoJSON } from "@terraformer/arcgis";
|
|
7
6
|
function getTravelDirection(key) {
|
|
8
7
|
if (key === "incidentsToFacilities") {
|
|
@@ -33,9 +32,9 @@ function getTravelDirection(key) {
|
|
|
33
32
|
* @restlink https://developers.arcgis.com/rest/network/api-reference/service-area-synchronous-service.htm
|
|
34
33
|
*/
|
|
35
34
|
export function serviceArea(requestOptions) {
|
|
36
|
-
|
|
37
|
-
requestOptions.params =
|
|
38
|
-
|
|
35
|
+
const endpoint = requestOptions.endpoint || ARCGIS_ONLINE_SERVICE_AREA_URL;
|
|
36
|
+
requestOptions.params = Object.assign({ returnFacilities: true, returnBarriers: true, returnPolylineBarriers: true, returnPolygonBarriers: true, preserveObjectID: true }, requestOptions.params);
|
|
37
|
+
const options = appendCustomParams(requestOptions, [
|
|
39
38
|
"barriers",
|
|
40
39
|
"polylineBarriers",
|
|
41
40
|
"polygonBarriers",
|
|
@@ -44,7 +43,7 @@ export function serviceArea(requestOptions) {
|
|
|
44
43
|
"returnBarriers",
|
|
45
44
|
"returnPolylineBarriers",
|
|
46
45
|
"returnPolygonBarriers",
|
|
47
|
-
"preserveObjectID"
|
|
46
|
+
"preserveObjectID"
|
|
48
47
|
]);
|
|
49
48
|
// Set travelDirection
|
|
50
49
|
if (requestOptions.travelDirection) {
|
|
@@ -73,7 +72,7 @@ export function serviceArea(requestOptions) {
|
|
|
73
72
|
options.params.barriers = normalizeLocationsList(requestOptions.barriers).join(";");
|
|
74
73
|
}
|
|
75
74
|
}
|
|
76
|
-
return request(cleanUrl(endpoint)
|
|
75
|
+
return request(`${cleanUrl(endpoint)}/solveServiceArea`, options).then(cleanResponse);
|
|
77
76
|
}
|
|
78
77
|
function cleanResponse(res) {
|
|
79
78
|
// remove "fieldAliases" because it does not do anything.
|
|
@@ -85,6 +84,6 @@ function cleanResponse(res) {
|
|
|
85
84
|
return res;
|
|
86
85
|
}
|
|
87
86
|
export default {
|
|
88
|
-
serviceArea
|
|
87
|
+
serviceArea
|
|
89
88
|
};
|
|
90
89
|
//# sourceMappingURL=serviceArea.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"serviceArea.js","sourceRoot":"","sources":["../../src/serviceArea.ts"],"names":[],"mappings":"AAAA;gBACgB
|
|
1
|
+
{"version":3,"file":"serviceArea.js","sourceRoot":"","sources":["../../src/serviceArea.ts"],"names":[],"mappings":"AAAA;gBACgB;AAEhB,OAAO,EACL,OAAO,EACP,QAAQ,EACR,kBAAkB,EAInB,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EACL,8BAA8B,EAE9B,sBAAsB,EACtB,YAAY,EACb,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAoCtD,SAAS,kBAAkB,CACzB,GAAsD;IAEtD,IAAI,GAAG,KAAK,uBAAuB,EAAE;QACnC,OAAO,mCAAmC,CAAC;KAC5C;SAAM;QACL,OAAO,iCAAiC,CAAC;KAC1C;AACH,CAAC;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,UAAU,WAAW,CACzB,cAAmC;IAEnC,MAAM,QAAQ,GAAG,cAAc,CAAC,QAAQ,IAAI,8BAA8B,CAAC;IAE3E,cAAc,CAAC,MAAM,mBACnB,gBAAgB,EAAE,IAAI,EACtB,cAAc,EAAE,IAAI,EACpB,sBAAsB,EAAE,IAAI,EAC5B,qBAAqB,EAAE,IAAI,EAC3B,gBAAgB,EAAE,IAAI,IACnB,cAAc,CAAC,MAAM,CACzB,CAAC;IAEF,MAAM,OAAO,GAAG,kBAAkB,CAAsB,cAAc,EAAE;QACtE,UAAU;QACV,kBAAkB;QAClB,iBAAiB;QACjB,aAAa;QACb,kBAAkB;QAClB,gBAAgB;QAChB,wBAAwB;QACxB,uBAAuB;QACvB,kBAAkB;KACnB,CAAC,CAAC;IAEH,sBAAsB;IACtB,IAAI,cAAc,CAAC,eAAe,EAAE;QAClC,OAAO,CAAC,MAAM,CAAC,eAAe,GAAG,kBAAkB,CACjD,cAAc,CAAC,eAAe,CAC/B,CAAC;KACH;IAED,uDAAuD;IAC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right (c) 2018 Environmental Systems Research Institute, Inc.\n * Apache-2.0 */\n\nimport {\n request,\n cleanUrl,\n appendCustomParams,\n ILocation, \n IPoint, \n IFeatureSet\n} from \"@esri/arcgis-rest-request\";\n\nimport {\n ARCGIS_ONLINE_SERVICE_AREA_URL,\n IEndpointOptions,\n normalizeLocationsList,\n isFeatureSet\n} from \"./helpers.js\";\n\nimport { arcgisToGeoJSON } from \"@terraformer/arcgis\";\n\nexport interface IServiceAreaOptions extends IEndpointOptions {\n /**\n * Specify one or more locations around which service areas are generated.\n */\n facilities: Array<IPoint | ILocation | [number, number]> | IFeatureSet;\n /**\n * Specify if the service should return routes.\n */\n travelDirection?: \"incidentsToFacilities\" | \"facilitiesToIncidents\";\n barriers?: Array<IPoint | ILocation | [number, number]> | IFeatureSet;\n polylineBarriers?: IFeatureSet;\n polygonBarriers?: IFeatureSet;\n outputLines?: boolean;\n returnFacilities?: boolean;\n returnBarriers?: boolean;\n returnPolylineBarriers?: boolean;\n returnPolygonBarriers?: boolean;\n preserveObjectID?: boolean;\n}\n\ninterface IFeatureSetWithGeoJson extends IFeatureSet {\n geoJson?: any;\n}\n\nexport interface IServiceAreaResponse {\n messages: string[];\n saPolygons?: IFeatureSetWithGeoJson;\n incidents?: IFeatureSet;\n facilities?: IFeatureSet;\n barriers?: IFeatureSet;\n polygonBarriers?: IFeatureSet;\n polylineBarriers?: IFeatureSet;\n}\n\nfunction getTravelDirection(\n key: \"incidentsToFacilities\" | \"facilitiesToIncidents\"\n): \"esriNATravelDirectionFromFacility\" | \"esriNATravelDirectionToFacility\" {\n if (key === \"incidentsToFacilities\") {\n return \"esriNATravelDirectionFromFacility\";\n } else {\n return \"esriNATravelDirectionToFacility\";\n }\n}\n\n/**\n * ```js\n * import { serviceArea } from '@esri/arcgis-rest-routing';\n * //\n * serviceArea({\n * facilities: [\n * [-90.444716, 38.635501],\n * [-90.311919, 38.633523],\n * [-90.451147, 38.581107]\n * ],\n * authentication\n * })\n * .then(response) // => {routes: {features: [{attributes: { ... }, geometry:{ ... }}]}\n * ```\n * Used to find the area that can be reached from the input location within a given travel time or travel distance. See the [REST Documentation](https://developers.arcgis.com/rest/network/api-reference/service-area-synchronous-service.htm) for more information.\n *\n * @param requestOptions Options to pass through to the routing service.\n * @returns A Promise that will resolve with service area polygons for the request.\n * @restlink https://developers.arcgis.com/rest/network/api-reference/service-area-synchronous-service.htm\n */\nexport function serviceArea(\n requestOptions: IServiceAreaOptions\n): Promise<IServiceAreaResponse> {\n const endpoint = requestOptions.endpoint || ARCGIS_ONLINE_SERVICE_AREA_URL;\n\n requestOptions.params = {\n returnFacilities: true,\n returnBarriers: true,\n returnPolylineBarriers: true,\n returnPolygonBarriers: true,\n preserveObjectID: true,\n ...requestOptions.params\n };\n\n const options = appendCustomParams<IServiceAreaOptions>(requestOptions, [\n \"barriers\",\n \"polylineBarriers\",\n \"polygonBarriers\",\n \"outputLines\",\n \"returnFacilities\",\n \"returnBarriers\",\n \"returnPolylineBarriers\",\n \"returnPolygonBarriers\",\n \"preserveObjectID\"\n ]);\n\n // Set travelDirection\n if (requestOptions.travelDirection) {\n options.params.travelDirection = getTravelDirection(\n requestOptions.travelDirection\n );\n }\n\n // the SAAS service does not support anonymous requests\n if (\n !requestOptions.authentication &&\n endpoint === ARCGIS_ONLINE_SERVICE_AREA_URL\n ) {\n return Promise.reject(\n \"Finding service areas using the ArcGIS service requires authentication\"\n );\n }\n\n if (isFeatureSet(requestOptions.facilities)) {\n options.params.facilities = requestOptions.facilities;\n } else {\n options.params.facilities = normalizeLocationsList(\n requestOptions.facilities\n ).join(\";\");\n }\n\n // optional input param that may need point geometry normalizing\n if (requestOptions.barriers) {\n if (isFeatureSet(requestOptions.barriers)) {\n options.params.barriers = requestOptions.barriers;\n } else {\n // optional point geometry barriers must be normalized, too\n // but not if provided as IFeatureSet type\n // note that optional polylineBarriers and polygonBarriers do not need to be normalized\n options.params.barriers = normalizeLocationsList(\n requestOptions.barriers\n ).join(\";\");\n }\n }\n\n return request(`${cleanUrl(endpoint)}/solveServiceArea`, options).then(\n cleanResponse\n );\n}\n\nfunction cleanResponse(res: any): IServiceAreaResponse {\n // remove \"fieldAliases\" because it does not do anything.\n delete res.saPolygons.fieldAliases;\n\n // add \"geoJson\" property to \"saPolygons\"\n if (res.saPolygons.spatialReference.wkid === 4326) {\n res.saPolygons.geoJson = arcgisToGeoJSON(res.saPolygons);\n }\n return res;\n}\n\nexport default {\n serviceArea\n};\n"]}
|
package/dist/esm/solveRoute.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ILocation, IPoint, IFeature, IFeatureSet } from "@esri/arcgis-rest-
|
|
2
|
-
import { IEndpointOptions } from "./helpers";
|
|
1
|
+
import { ILocation, IPoint, IFeature, IFeatureSet } from "@esri/arcgis-rest-request";
|
|
2
|
+
import { IEndpointOptions } from "./helpers.js";
|
|
3
3
|
interface IFeatureSetWithGeoJson extends IFeatureSet {
|
|
4
4
|
geoJson?: {};
|
|
5
5
|
}
|
package/dist/esm/solveRoute.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
/* Copyright (c) 2018 Environmental Systems Research Institute, Inc.
|
|
2
2
|
* Apache-2.0 */
|
|
3
|
-
import { __assign } from "tslib";
|
|
4
3
|
import { request, cleanUrl } from "@esri/arcgis-rest-request";
|
|
5
|
-
import { ARCGIS_ONLINE_ROUTING_URL, decompressGeometry, isFeatureSet
|
|
4
|
+
import { ARCGIS_ONLINE_ROUTING_URL, decompressGeometry, isFeatureSet } from "./helpers.js";
|
|
6
5
|
import { arcgisToGeoJSON } from "@terraformer/arcgis";
|
|
7
6
|
function isLocationArray(coords) {
|
|
8
7
|
return (coords.length === 2 ||
|
|
@@ -32,7 +31,7 @@ function isLocation(coords) {
|
|
|
32
31
|
* @restlink https://developers.arcgis.com/rest/network/api-reference/route-synchronous-service.htm
|
|
33
32
|
*/
|
|
34
33
|
export function solveRoute(requestOptions) {
|
|
35
|
-
|
|
34
|
+
const options = Object.assign({ endpoint: requestOptions.endpoint || ARCGIS_ONLINE_ROUTING_URL, params: {} }, requestOptions);
|
|
36
35
|
// the SAAS service does not support anonymous requests
|
|
37
36
|
if (!requestOptions.authentication &&
|
|
38
37
|
options.endpoint === ARCGIS_ONLINE_ROUTING_URL) {
|
|
@@ -42,7 +41,7 @@ export function solveRoute(requestOptions) {
|
|
|
42
41
|
options.params.stops = requestOptions.stops;
|
|
43
42
|
}
|
|
44
43
|
else {
|
|
45
|
-
|
|
44
|
+
const stops = requestOptions.stops.map((coords) => {
|
|
46
45
|
if (isLocationArray(coords)) {
|
|
47
46
|
return coords.join();
|
|
48
47
|
}
|
|
@@ -63,12 +62,12 @@ export function solveRoute(requestOptions) {
|
|
|
63
62
|
});
|
|
64
63
|
options.params.stops = stops.join(";");
|
|
65
64
|
}
|
|
66
|
-
return request(cleanUrl(options.endpoint)
|
|
65
|
+
return request(`${cleanUrl(options.endpoint)}/solve`, options).then(cleanResponse);
|
|
67
66
|
}
|
|
68
67
|
function cleanResponse(res) {
|
|
69
68
|
if (res.directions && res.directions.length > 0) {
|
|
70
|
-
res.directions = res.directions.map(
|
|
71
|
-
direction.features = direction.features.map(
|
|
69
|
+
res.directions = res.directions.map((direction) => {
|
|
70
|
+
direction.features = direction.features.map((feature) => {
|
|
72
71
|
feature.geometry = decompressGeometry(feature.compressedGeometry);
|
|
73
72
|
return feature;
|
|
74
73
|
});
|
|
@@ -77,21 +76,21 @@ function cleanResponse(res) {
|
|
|
77
76
|
}
|
|
78
77
|
// add "geoJson" property to "routes"
|
|
79
78
|
if (res.routes.spatialReference.wkid === 4326) {
|
|
80
|
-
|
|
79
|
+
const features = res.routes.features.map((feature) => {
|
|
81
80
|
return {
|
|
82
81
|
type: "Feature",
|
|
83
82
|
geometry: arcgisToGeoJSON(feature.geometry),
|
|
84
|
-
properties: Object.assign({}, feature.attributes)
|
|
83
|
+
properties: Object.assign({}, feature.attributes)
|
|
85
84
|
};
|
|
86
85
|
});
|
|
87
86
|
res.routes.geoJson = {
|
|
88
87
|
type: "FeatureCollection",
|
|
89
|
-
features
|
|
88
|
+
features
|
|
90
89
|
};
|
|
91
90
|
}
|
|
92
91
|
return res;
|
|
93
92
|
}
|
|
94
93
|
export default {
|
|
95
|
-
solveRoute
|
|
94
|
+
solveRoute
|
|
96
95
|
};
|
|
97
96
|
//# sourceMappingURL=solveRoute.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"solveRoute.js","sourceRoot":"","sources":["../../src/solveRoute.ts"],"names":[],"mappings":"AAAA;gBACgB
|
|
1
|
+
{"version":3,"file":"solveRoute.js","sourceRoot":"","sources":["../../src/solveRoute.ts"],"names":[],"mappings":"AAAA;gBACgB;AAEhB,OAAO,EACL,OAAO,EACP,QAAQ,EAKT,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EACL,yBAAyB,EAEzB,kBAAkB,EAClB,YAAY,EACb,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AA+BtD,SAAS,eAAe,CACtB,MAAwE;IAExE,OAAO,CACJ,MAA2B,CAAC,MAAM,KAAK,CAAC;QACxC,MAAmC,CAAC,MAAM,KAAK,CAAC,CAClD,CAAC;AACJ,CAAC;AAED,SAAS,UAAU,CACjB,MAAwE;IAExE,OAAO,CACJ,MAAoB,CAAC,QAAQ,KAAK,SAAS;QAC3C,MAAoB,CAAC,GAAG,KAAK,SAAS,CACxC,CAAC;AACJ,CAAC;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,UAAU,UAAU,CACxB,cAAkC;IAElC,MAAM,OAAO,mBACX,QAAQ,EAAE,cAAc,CAAC,QAAQ,IAAI,yBAAyB,EAC9D,MAAM,EAAE,EAAE,IACP,cAAc,CAClB,CAAC;IAEF,uDAAuD;IACvD,IACE,CAAC,cAAc,CAAC,cAAc;QAC9B,OAAO,CAAC,QAAQ,KAAK,yBAAyB,EAC9C;QACA,OAAO,OAAO,CAAC,MAA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C,CAAC,IAAI,CACjE,aAAa,CACd,CAAC;AACJ,CAAC;AAED,SAAS,aAAa,CAAC,GAAQ;IAC7B,IAAI,GAAG,CAAC,UAAU,IAAI,GAAG,CAAC,UAAU,CAAC,MAAM,GAAG,CAAC,EAAE;QAC/C,GAAG,CAAC,UAAU,GAAG,GAAG,CAAC,UAAU,CAAC,GAAG,CACjC,CAAC,SAKA,EAAE,EAAE;YACH,SAAS,CAAC,QAAQ,GAAG,SAAS,CAAC,QAAQ,CAAC,GAAG,CACzC,CAAC,OAAuC,EAAE,EAAE;gBAC1C,OAAO,CAAC,QAAQ,GAAG,kBAAkB,CAAC,OAAO,CAAC,kBAAkB,CAAC,CAAC;gBAClE,OAAO,OAAO,CAAC;YACjB,CAAC,CACF,CAAC;YACF,OAAO,SAAS,CAAC;QACnB,CAAC,CACF,CAAC;KACH;IAED,qCAAqC;IACrC,IAAI,GAAG,CAAC,MAAM,CAAC,gBAAgB,CAAC,IAAI,KAAK,IAAI,EAAE;QAC7C,MAAM,QAAQ,GAAG,GAAG,CAAC,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,OAAY,EAAE,EAAE;YACxD,OAAO;gBACL,IAAI,EAAE,SAAS;gBACf,QAAQ,EAAE,eAAe,CAAC,OAAO,CAAC,QAAQ,CAAC;gBAC3C,UAAU,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,OAAO,CAAC,UAAU,CAAC;aAClD,CAAC;QACJ,CAAC,CAAC,CAAC;QAEH,GAAG,CAAC,MAAM,CAAC,OAAO,GAAG;YACnB,IAAI,EAAE,mBAAmB;YACzB,QAAQ;SACT,CAAC;KACH;IACD,OAAO,GAAG,CAAC;AACb,CAAC;AAED,eAAe;IACb,UAAU;CACX,CAAC","sourcesContent":["/* Copyright (c) 2018 Environmental Systems Research Institute, Inc.\r\n * Apache-2.0 */\r\n\r\nimport { \r\n request, \r\n cleanUrl, \r\n ILocation,\r\n IPoint,\r\n IFeature,\r\n IFeatureSet\r\n} from \"@esri/arcgis-rest-request\";\r\n\r\nimport {\r\n ARCGIS_ONLINE_ROUTING_URL,\r\n IEndpointOptions,\r\n decompressGeometry,\r\n isFeatureSet\r\n} from \"./helpers.js\";\r\n\r\nimport { arcgisToGeoJSON } from \"@terraformer/arcgis\";\r\n\r\ninterface IFeatureWithCompressedGeometry extends IFeature {\r\n compressedGeometry?: string;\r\n}\r\n\r\ninterface IFeatureSetWithGeoJson extends IFeatureSet {\r\n geoJson?: {};\r\n}\r\n\r\nexport interface ISolveRouteOptions extends IEndpointOptions {\r\n /**\r\n * Specify two or more locations between which the route is to be found.\r\n */\r\n stops:\r\n | Array<IPoint | ILocation | [number, number] | [number, number, number]>\r\n | IFeatureSet;\r\n}\r\n\r\nexport interface ISolveRouteResponse {\r\n messages: string[];\r\n checksum: string;\r\n routes: IFeatureSetWithGeoJson;\r\n directions?: Array<{\r\n routeId: number;\r\n routeName: string;\r\n summary: object;\r\n features: IFeature[];\r\n }>;\r\n}\r\n\r\nfunction isLocationArray(\r\n coords: ILocation | IPoint | [number, number] | [number, number, number]\r\n): coords is [number, number] | [number, number, number] {\r\n return (\r\n (coords as [number, number]).length === 2 ||\r\n (coords as [number, number, number]).length === 3\r\n );\r\n}\r\n\r\nfunction isLocation(\r\n coords: ILocation | IPoint | [number, number] | [number, number, number]\r\n): coords is ILocation {\r\n return (\r\n (coords as ILocation).latitude !== undefined ||\r\n (coords as ILocation).lat !== undefined\r\n );\r\n}\r\n\r\n/**\r\n * ```js\r\n * import { solveRoute } from '@esri/arcgis-rest-routing';\r\n * //\r\n * solveRoute({\r\n * stops: [\r\n * [-117.195677, 34.056383],\r\n * [-117.918976, 33.812092],\r\n * ],\r\n * authentication\r\n * })\r\n * .then(response) // => {routes: {features: [{attributes: { ... }, geometry:{ ... }}]}\r\n * ```\r\n * Used to find the best way to get from one location to another or to visit several locations. See the [REST Documentation](https://developers.arcgis.com/rest/network/api-reference/route-synchronous-service.htm) for more information.\r\n *\r\n * @param requestOptions Options to pass through to the routing service.\r\n * @returns A Promise that will resolve with routes and directions for the request.\r\n * @restlink https://developers.arcgis.com/rest/network/api-reference/route-synchronous-service.htm\r\n */\r\nexport function solveRoute(\r\n requestOptions: ISolveRouteOptions\r\n): Promise<ISolveRouteResponse> {\r\n const options: ISolveRouteOptions = {\r\n endpoint: requestOptions.endpoint || ARCGIS_ONLINE_ROUTING_URL,\r\n params: {},\r\n ...requestOptions\r\n };\r\n\r\n // the SAAS service does not support anonymous requests\r\n if (\r\n !requestOptions.authentication &&\r\n options.endpoint === ARCGIS_ONLINE_ROUTING_URL\r\n ) {\r\n return Promise.reject(\r\n \"Routing using the ArcGIS service requires authentication\"\r\n );\r\n }\r\n\r\n if (isFeatureSet(requestOptions.stops)) {\r\n options.params.stops = requestOptions.stops;\r\n } else {\r\n const stops: string[] = requestOptions.stops.map((coords) => {\r\n if (isLocationArray(coords)) {\r\n return coords.join();\r\n } else if (isLocation(coords)) {\r\n if (coords.lat) {\r\n return (\r\n coords.long + \",\" + coords.lat + (coords.z ? \",\" + coords.z : \"\")\r\n );\r\n } else {\r\n return (\r\n coords.longitude +\r\n \",\" +\r\n coords.latitude +\r\n (coords.z ? \",\" + coords.z : \"\")\r\n );\r\n }\r\n } else {\r\n return coords.x + \",\" + coords.y + (coords.z ? \",\" + coords.z : \"\");\r\n }\r\n });\r\n\r\n options.params.stops = stops.join(\";\");\r\n }\r\n\r\n return request(`${cleanUrl(options.endpoint)}/solve`, options).then(\r\n cleanResponse\r\n );\r\n}\r\n\r\nfunction cleanResponse(res: any): ISolveRouteResponse {\r\n if (res.directions && res.directions.length > 0) {\r\n res.directions = res.directions.map(\r\n (direction: {\r\n features: IFeatureWithCompressedGeometry[];\r\n routeId: number;\r\n routeName: string;\r\n summary: {};\r\n }) => {\r\n direction.features = direction.features.map(\r\n (feature: IFeatureWithCompressedGeometry) => {\r\n feature.geometry = decompressGeometry(feature.compressedGeometry);\r\n return feature;\r\n }\r\n );\r\n return direction;\r\n }\r\n );\r\n }\r\n\r\n // add \"geoJson\" property to \"routes\"\r\n if (res.routes.spatialReference.wkid === 4326) {\r\n const features = res.routes.features.map((feature: any) => {\r\n return {\r\n type: \"Feature\",\r\n geometry: arcgisToGeoJSON(feature.geometry),\r\n properties: Object.assign({}, feature.attributes)\r\n };\r\n });\r\n\r\n res.routes.geoJson = {\r\n type: \"FeatureCollection\",\r\n features\r\n };\r\n }\r\n return res;\r\n}\r\n\r\nexport default {\r\n solveRoute\r\n};\r\n"]}
|
package/package.json
CHANGED
|
@@ -1,65 +1,69 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@esri/arcgis-rest-routing",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.0-beta.2",
|
|
4
4
|
"description": "Routing helpers for @esri/arcgis-rest-js",
|
|
5
|
-
"
|
|
6
|
-
"
|
|
5
|
+
"license": "Apache-2.0",
|
|
6
|
+
"keywords": [
|
|
7
|
+
"ES6",
|
|
8
|
+
"arcgis",
|
|
9
|
+
"esri",
|
|
10
|
+
"fetch",
|
|
11
|
+
"promise",
|
|
12
|
+
"typescript"
|
|
13
|
+
],
|
|
14
|
+
"type": "module",
|
|
15
|
+
"main": "dist/cjs/index.js",
|
|
7
16
|
"module": "dist/esm/index.js",
|
|
8
|
-
"
|
|
9
|
-
"
|
|
17
|
+
"unpkg": "dist/bundled/routing.umd.min.js",
|
|
18
|
+
"exports": {
|
|
19
|
+
".": {
|
|
20
|
+
"import": "./dist/esm/index.js",
|
|
21
|
+
"require": "./dist/cjs/index.js"
|
|
22
|
+
}
|
|
23
|
+
},
|
|
10
24
|
"types": "dist/esm/index.d.ts",
|
|
11
|
-
"
|
|
25
|
+
"sideEffects": false,
|
|
12
26
|
"files": [
|
|
13
27
|
"dist/**"
|
|
14
28
|
],
|
|
29
|
+
"scripts": {
|
|
30
|
+
"build": "npm-run-all --parallel build:*",
|
|
31
|
+
"postbuild": "node ../../scripts/create-dist-package-jsons.js",
|
|
32
|
+
"build:bundled": "rollup -c ../../rollup.js",
|
|
33
|
+
"build:cjs": "tsc --outDir ./dist/cjs -m commonjs",
|
|
34
|
+
"build:esm": "tsc --outDir ./dist/esm --declaration",
|
|
35
|
+
"dev": "npm-run-all --parallel dev:*",
|
|
36
|
+
"dev:bundled": "rollup -w -c ../../rollup.js",
|
|
37
|
+
"dev:cjs": "tsc -w --outDir ./dist/cjs -m commonjs",
|
|
38
|
+
"dev:esm": "tsc -w --outDir ./dist/esm --declaration"
|
|
39
|
+
},
|
|
40
|
+
"engines": {
|
|
41
|
+
"node": ">=12.20.0"
|
|
42
|
+
},
|
|
15
43
|
"dependencies": {
|
|
16
|
-
"@esri/arcgis-rest-types": "^3.4.1",
|
|
17
44
|
"@terraformer/arcgis": "^2.0.7",
|
|
18
45
|
"@types/terraformer__arcgis": "^2.0.0",
|
|
19
|
-
"tslib": "^
|
|
20
|
-
},
|
|
21
|
-
"devDependencies": {
|
|
22
|
-
"@esri/arcgis-rest-auth": "^3.4.1",
|
|
23
|
-
"@esri/arcgis-rest-request": "^3.4.1"
|
|
46
|
+
"tslib": "^2.3.0"
|
|
24
47
|
},
|
|
25
48
|
"peerDependencies": {
|
|
26
|
-
"@esri/arcgis-rest-
|
|
27
|
-
"@esri/arcgis-rest-request": "^3.0.0"
|
|
28
|
-
},
|
|
29
|
-
"scripts": {
|
|
30
|
-
"prepare": "npm run build",
|
|
31
|
-
"build": "npm run build:node && npm run build:umd && npm run build:esm",
|
|
32
|
-
"build:esm": "tsc --module es2015 --outDir ./dist/esm --declaration",
|
|
33
|
-
"build:umd": "rollup -c ../../umd-base-profile.js && rollup -c ../../umd-production-profile.js",
|
|
34
|
-
"build:node": "tsc --module commonjs --outDir ./dist/node",
|
|
35
|
-
"dev:esm": "tsc -w --module es2015 --outDir ./dist/esm --declaration",
|
|
36
|
-
"dev:umd": "rollup -w -c ../../umd-base-profile.js",
|
|
37
|
-
"dev:node": "tsc -w --module commonjs --outDir ./dist/node"
|
|
49
|
+
"@esri/arcgis-rest-request": "4.0.0-beta.2"
|
|
38
50
|
},
|
|
39
|
-
"
|
|
40
|
-
"
|
|
51
|
+
"devDependencies": {
|
|
52
|
+
"@esri/arcgis-rest-request": "4.0.0-beta.2"
|
|
41
53
|
},
|
|
54
|
+
"contributors": [
|
|
55
|
+
"Gavin Rehkemper <gavin@gavinr.com>"
|
|
56
|
+
],
|
|
57
|
+
"homepage": "https://github.com/Esri/arcgis-rest-js#readme",
|
|
42
58
|
"repository": {
|
|
43
59
|
"type": "git",
|
|
44
60
|
"url": "git+https://github.com/Esri/arcgis-rest-js.git",
|
|
45
61
|
"directory": "packages/arcgis-rest-routing"
|
|
46
62
|
},
|
|
47
|
-
"contributors": [
|
|
48
|
-
{
|
|
49
|
-
"name": "Gavin Rehkemper",
|
|
50
|
-
"email": "gavin@gavinr.com"
|
|
51
|
-
}
|
|
52
|
-
],
|
|
53
63
|
"bugs": {
|
|
54
64
|
"url": "https://github.com/Esri/arcgis-rest-js/issues"
|
|
55
65
|
},
|
|
56
|
-
"
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
"promise",
|
|
60
|
-
"fetch",
|
|
61
|
-
"arcgis",
|
|
62
|
-
"esri",
|
|
63
|
-
"ES6"
|
|
64
|
-
]
|
|
66
|
+
"publishConfig": {
|
|
67
|
+
"access": "public"
|
|
68
|
+
}
|
|
65
69
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"closestFacility.js","sourceRoot":"","sources":["../../src/closestFacility.ts"],"names":[],"mappings":";AAAA;gBACgB;;;;AAEhB,iEAImC;AASnC,qCAKmB;AAEnB,8CAAsD;AAsEtD,SAAS,kBAAkB,CACzB,GAAsD;IAEtD,IAAI,GAAG,KAAK,uBAAuB,EAAE;QACnC,OAAO,mCAAmC,CAAC;KAC5C;SAAM;QACL,OAAO,iCAAiC,CAAC;KAC1C;AACH,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,SAAgB,eAAe,CAC7B,cAAuC;IAEvC,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E,CAAC,CAAC;IAE7C,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,EAAE;QAC1C,kCAAkC;QAClC,8DAA8D;QAC9D,CAAC,GAAG,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,SAAS,CAAC;QACzC,SAAS,GAAG,CAAC,CAAC;QAEd,oCAAoC;QACpC,8DAA8D;QAC9D,CAAC,GAAG,QAAQ,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,SAAS,CAAC;QAC7C,SAAS,GAAG,CAAC,CAAC;QAEd,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,WAAW,EAAE,CAAC,GAAG,WAAW,CAAe,CAAC,CAAC;KAC/D;IAED,OAAO;QACL,KAAK,EAAE,CAAC,MAAM,CAAC;KACH,CAAC;AACjB,CAAC;AA9BD,gDA8BC;AAED;;GAEG;AACH,SAAgB,YAAY,CAAC,GAAQ;IACnC,OAAO,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,GAAG,EAAE,UAAU,CAAC,CAAC;AAC/D,CAAC;AAFD,oCAEC"}
|
package/dist/node/index.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/* Copyright (c) 2018 Environmental Systems Research Institute, Inc.
|
|
3
|
-
* Apache-2.0 */
|
|
4
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
var tslib_1 = require("tslib");
|
|
6
|
-
tslib_1.__exportStar(require("./solveRoute"), exports);
|
|
7
|
-
tslib_1.__exportStar(require("./closestFacility"), exports);
|
|
8
|
-
tslib_1.__exportStar(require("./serviceArea"), exports);
|
|
9
|
-
tslib_1.__exportStar(require("./originDestinationMatrix"), exports);
|
|
10
|
-
tslib_1.__exportStar(require("./helpers"), exports);
|
|
11
|
-
//# sourceMappingURL=index.js.map
|
package/dist/node/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAAA;gBACgB;;;AAEhB,uDAA6B;AAC7B,4DAAkC;AAClC,wDAA8B;AAC9B,oEAA0C;AAC1C,oDAA0B"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"originDestinationMatrix.js","sourceRoot":"","sources":["../../src/originDestinationMatrix.ts"],"names":[],"mappings":";AAAA;gBACgB;;;;AAEhB,iEAKmC;AASnC,qCAKmB;AAEnB,8CAAsD;AAiDtD;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,SAAgB,uBAAuB,CACrC,cAA+C;IAE/C,IAAM,QAAQ,GACZ,cAAc,CAAC,QAAQ,IAAI,qDAA2C,CAAC;IAEzE,cAAc,CAAC,MAAM,sBACnB,UAAU,EAAE,4BAA4B,EACxC,aAAa,EAAE,IAAI,EACnB,kBAAkB,EAAE,IAAI,EACxB,cAAc,EAAE,IAAI,EACpB,sBAAsB,EAAE,IAAI,EAC5B,qBAAqB,EAAE,IAAI,IACxB,cAAc,CAAC,MAAM,CACzB,CAAC;IAEF,IAAM,OAAO,GAAG,wCAAkB,CAChC,cAAc,EACd;QACE,YAAY;QACZ,UAAU;QACV,kBAAkB;QAClB,iBAAiB;QACjB,eAAe;QACf,oBAAoB;QACpB,gBAAgB;QAChB,wBAAwB;QACxB,uBAAuB;KACxB,CACF,CAAC;IAEF,uDAAuD;IACvD,IACE,CAAC,cAAc,CAAC,cAAc;QAC9B,QAAQ,KAAK,qDAA2C,EACxD;QACA,OAAO,OAAO,CAAC,MAAM,CACnB,iGAAiG,CAClG,CAAC;KACH;IAED,sGAAsG;IACtG,IAAI,sBAAY,CAAC,cAAc,CAAC,OAAO,CAAC,EAAE;QACxC,OAAO,CAAC,MAAM,CAAC,OAAO,GAAG,cAAc,CAAC,OAAO,CAAC;KACjD;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