@esri/arcgis-rest-elevation 1.0.0
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 +84 -0
- package/dist/bundled/elevation.esm.js +84 -0
- package/dist/bundled/elevation.esm.js.map +1 -0
- package/dist/bundled/elevation.esm.min.js +7 -0
- package/dist/bundled/elevation.esm.min.js.map +1 -0
- package/dist/bundled/elevation.umd.js +93 -0
- package/dist/bundled/elevation.umd.js.map +1 -0
- package/dist/bundled/elevation.umd.min.js +7 -0
- package/dist/bundled/elevation.umd.min.js.map +1 -0
- package/dist/cjs/findElevationAtManyPoints.js +47 -0
- package/dist/cjs/findElevationAtManyPoints.js.map +1 -0
- package/dist/cjs/findElevationAtPoint.js +38 -0
- package/dist/cjs/findElevationAtPoint.js.map +1 -0
- package/dist/cjs/index.js +8 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/openapi-types.js +7 -0
- package/dist/cjs/openapi-types.js.map +1 -0
- package/dist/cjs/package.json +3 -0
- package/dist/cjs/utils.js +5 -0
- package/dist/cjs/utils.js.map +1 -0
- package/dist/esm/findElevationAtManyPoints.d.ts +48 -0
- package/dist/esm/findElevationAtManyPoints.js +43 -0
- package/dist/esm/findElevationAtManyPoints.js.map +1 -0
- package/dist/esm/findElevationAtPoint.d.ts +40 -0
- package/dist/esm/findElevationAtPoint.js +34 -0
- package/dist/esm/findElevationAtPoint.js.map +1 -0
- package/dist/esm/index.d.ts +3 -0
- package/dist/esm/index.js +5 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/openapi-types.d.ts +473 -0
- package/dist/esm/openapi-types.js +6 -0
- package/dist/esm/openapi-types.js.map +1 -0
- package/dist/esm/package.json +3 -0
- package/dist/esm/utils.d.ts +1 -0
- package/dist/esm/utils.js +2 -0
- package/dist/esm/utils.js.map +1 -0
- package/package.json +75 -0
package/README.md
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
[![npm version][npm-img]][npm-url]
|
|
2
|
+
[![gzip bundle size][gzip-image]][npm-url]
|
|
3
|
+
[![Coverage Status][coverage-img]][coverage-url]
|
|
4
|
+
[](https://raw.githubusercontent.com/Esri/arcgis-rest-js/master/LICENSE)
|
|
5
|
+
|
|
6
|
+
[npm-img]: https://img.shields.io/npm/v/@esri/arcgis-rest-elevation.svg?style=flat-square
|
|
7
|
+
[npm-url]: https://www.npmjs.com/package/@esri/arcgis-rest-elevation
|
|
8
|
+
[gzip-image]: https://img.badgesize.io/https://unpkg.com/@esri/arcgis-rest-elevation/dist/bundled/elevation.umd.min.js?compression=gzip
|
|
9
|
+
[coverage-img]: https://codecov.io/gh/Esri/arcgis-rest-js/branch/master/graph/badge.svg
|
|
10
|
+
[coverage-url]: https://codecov.io/gh/Esri/arcgis-rest-js
|
|
11
|
+
|
|
12
|
+
# @esri/arcgis-rest-places
|
|
13
|
+
|
|
14
|
+
> A wrapper class to access the ArcGIS Elevation service for [`@esri/arcgis-rest-request`](https://github.com/Esri/arcgis-rest-js).
|
|
15
|
+
|
|
16
|
+
### Example
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
npm install @esri/arcgis-rest-request
|
|
20
|
+
npm install @esri/arcgis-rest-elevation
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
```js
|
|
24
|
+
import { findElevationAtPoint } from "@esri/arcgis-rest-elevation";
|
|
25
|
+
import { ApiKeyManager } from "@esri/arcgis-rest-request";
|
|
26
|
+
|
|
27
|
+
const response = await findElevationAtPoint({
|
|
28
|
+
lon: -179.99,
|
|
29
|
+
lat: -85.05,
|
|
30
|
+
authentication: ApiKeyManager.fromKey("YOUR_ACCESS_TOKEN");
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
console.log(response.result.point.z)
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### API Reference
|
|
37
|
+
|
|
38
|
+
@TODO
|
|
39
|
+
|
|
40
|
+
### Issues
|
|
41
|
+
|
|
42
|
+
If something isn't working the way you expected, please take a look at [previously logged issues](https://github.com/Esri/arcgis-rest-js/issues) first. Have you found a new bug? Want to request a new feature? We'd [**love**](https://github.com/Esri/arcgis-rest-js/issues/new) to hear from you.
|
|
43
|
+
|
|
44
|
+
If you're looking for help you can also post issues on [GIS Stackexchange](http://gis.stackexchange.com/questions/ask?tags=esri-oss).
|
|
45
|
+
|
|
46
|
+
### Versioning
|
|
47
|
+
|
|
48
|
+
For transparency into the release cycle and in striving to maintain backward compatibility, @esri/arcgis-rest-js is maintained under Semantic Versioning guidelines and will adhere to these rules whenever possible.
|
|
49
|
+
|
|
50
|
+
For more information on SemVer, please visit <http://semver.org/>.
|
|
51
|
+
|
|
52
|
+
### Contributing
|
|
53
|
+
|
|
54
|
+
Esri welcomes contributions from anyone and everyone. Please see our [guidelines for contributing](CONTRIBUTING.md).
|
|
55
|
+
|
|
56
|
+
### Generating Types from Open API
|
|
57
|
+
|
|
58
|
+
The places service publishes an Open API definition. Eventually this will live at a public URL on the service itself. However for now it lives inside the Esri internal GitHub Enterprise installation. To generate the types view the raw file on GitHub Enterprise and replace the URL below.
|
|
59
|
+
|
|
60
|
+
```
|
|
61
|
+
npx openapi-typescript@5 URL_TO_RAW_SPEC_FILE --output packages/arcgis-rest-places/src/openapi-types.ts
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
The generated types are used in the interfaces for ArcGIS REST JS.
|
|
65
|
+
|
|
66
|
+
### [Changelog](https://github.com/Esri/arcgis-rest-js/blob/master/CHANGELOG.md)
|
|
67
|
+
|
|
68
|
+
### License
|
|
69
|
+
|
|
70
|
+
Copyright © 2023 Esri
|
|
71
|
+
|
|
72
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
73
|
+
you may not use this file except in compliance with the License.
|
|
74
|
+
You may obtain a copy of the License at
|
|
75
|
+
|
|
76
|
+
> http://www.apache.org/licenses/LICENSE-2.0
|
|
77
|
+
|
|
78
|
+
Unless required by applicable law or agreed to in writing, software
|
|
79
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
80
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
81
|
+
See the License for the specific language governing permissions and
|
|
82
|
+
limitations under the License.
|
|
83
|
+
|
|
84
|
+
A copy of the license is available in the repository's [LICENSE](../../LICENSE) file.
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/* @preserve
|
|
2
|
+
* @esri/arcgis-rest-elevation - v1.0.0 - Apache-2.0
|
|
3
|
+
* Copyright (c) 2017-2025 Esri, Inc.
|
|
4
|
+
* Thu Jan 30 2025 15:44:10 GMT+0000 (Coordinated Universal Time)
|
|
5
|
+
*/
|
|
6
|
+
import { appendCustomParams, request } from '@esri/arcgis-rest-request';
|
|
7
|
+
|
|
8
|
+
const baseUrl = "https://elevation-api.arcgis.com/arcgis/rest/services/elevation-service/v1";
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* This method returns the elevation in meters at a given longitude and latitude
|
|
12
|
+
* within the WGS84 coordinate system. By default the elevation is measured with
|
|
13
|
+
* respect to the Earth's mean sea level. It takes into account the local
|
|
14
|
+
* variations in gravity and provides a consistent vertical reference.
|
|
15
|
+
*
|
|
16
|
+
* If the relativeTo query parameter is set to `ellipsoid`, the elevation will be
|
|
17
|
+
* measured with respect to the ellipsoid. This is a mathematical model that
|
|
18
|
+
* approximates the shape of the Earth. It does not consider local variations
|
|
19
|
+
* in gravity and is commonly used in GPS positioning.
|
|
20
|
+
*
|
|
21
|
+
* ```
|
|
22
|
+
* import { findElevationAtPoint } from "@esri/arcgis-rest-elevation";
|
|
23
|
+
* import { ApiKeyManager } from "@esri/arcgis-rest-request";
|
|
24
|
+
*
|
|
25
|
+
* const results = await findElevationAtPoint({
|
|
26
|
+
* lon: -179.99,
|
|
27
|
+
* lat: -85.05,
|
|
28
|
+
* authentication: ApiKeyManager.fromKey("YOUR_ACCESS_TOKEN");
|
|
29
|
+
* });
|
|
30
|
+
*
|
|
31
|
+
* console.log(results)
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
34
|
+
function findElevationAtPoint(requestOptions) {
|
|
35
|
+
const options = appendCustomParams(requestOptions, ["lon", "lat", "relativeTo"], Object.assign({}, requestOptions));
|
|
36
|
+
return request(`${baseUrl}/elevation/at-point`, Object.assign(Object.assign({}, options), { httpMethod: "GET" })).then((response) => {
|
|
37
|
+
const r = Object.assign({}, response);
|
|
38
|
+
return r;
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* This method returns elevations in meters at given longitudes and latitudes
|
|
44
|
+
* within the WGS84 coordinate system. The order of the points returned by this
|
|
45
|
+
* request will be the same as the order of the points passed in the coordinates
|
|
46
|
+
* parameter.
|
|
47
|
+
*
|
|
48
|
+
* If the distance between the furthest West and furthest East coordinate or
|
|
49
|
+
* the furthest North and furthest South coordinate exceeds 50km, the service
|
|
50
|
+
* will return a 400 HTTP response as the distance between these points is too
|
|
51
|
+
* large.
|
|
52
|
+
*
|
|
53
|
+
* By default the elevation is measured with respect to the Earth's mean sea level.
|
|
54
|
+
* It takes into account the local variations in gravity and provides a consistent
|
|
55
|
+
* vertical reference.
|
|
56
|
+
*
|
|
57
|
+
* If the relativeTo query parameter is set to `ellipsoid`, the elevation will be
|
|
58
|
+
* measured with respect to the ellipsoid. This is a mathematical model that
|
|
59
|
+
* approximates the shape of the Earth. It does not consider local variations
|
|
60
|
+
* in gravity and is commonly used in GPS positioning.
|
|
61
|
+
*
|
|
62
|
+
* ```
|
|
63
|
+
* import { findElevationAtManyPoints } from "@esri/arcgis-rest-elevation";
|
|
64
|
+
* import { ApiKeyManager } from "@esri/arcgis-rest-request";
|
|
65
|
+
*
|
|
66
|
+
* const results = await findElevationAtManyPoints({
|
|
67
|
+
* coordinates: [[31.134167, 29.979167], [31.130833, 29.976111], [31.128333, 29.9725]],
|
|
68
|
+
* authentication: ApiKeyManager.fromKey("YOUR_ACCESS_TOKEN");
|
|
69
|
+
* });
|
|
70
|
+
*
|
|
71
|
+
* console.log(results)
|
|
72
|
+
* ```
|
|
73
|
+
*/
|
|
74
|
+
function findElevationAtManyPoints(requestOptions) {
|
|
75
|
+
const options = appendCustomParams(requestOptions, ["relativeTo"], Object.assign({}, requestOptions));
|
|
76
|
+
options.params.coordinates = JSON.stringify(requestOptions.coordinates);
|
|
77
|
+
return request(`${baseUrl}/elevation/at-many-points`, Object.assign({}, options)).then((response) => {
|
|
78
|
+
const r = Object.assign({}, response);
|
|
79
|
+
return r;
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export { findElevationAtManyPoints, findElevationAtPoint };
|
|
84
|
+
//# sourceMappingURL=elevation.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"elevation.esm.js","sources":["../../src/utils.ts","../../src/findElevationAtPoint.ts","../../src/findElevationAtManyPoints.ts"],"sourcesContent":["export const baseUrl =\n \"https://elevation-api.arcgis.com/arcgis/rest/services/elevation-service/v1\";\n","import {\n request,\n appendCustomParams,\n IRequestOptions\n} from \"@esri/arcgis-rest-request\";\n\nimport { operations } from \"./openapi-types.js\";\nimport { baseUrl } from \"./utils.js\";\n\n// determine the list of allowed params we want to allow as options\n// this should match the array given to appendCustomParams below\ntype queryParams = Pick<\n operations[\"ElevationAtPointGet\"][\"parameters\"][\"query\"],\n \"lon\" | \"lat\" | \"relativeTo\"\n>;\n\n// get the correct type of the response format\ntype successResponse =\n operations[\"ElevationAtPointGet\"][\"responses\"][\"200\"][\"content\"][\"application/json\"];\n\n/**\n * The response format for {@linkcode findElevationAtPoint};\n */\nexport interface IFindElevationAtPointResponse extends successResponse {}\n\n/**\n * Options for {@linkcode findElevationAtPoint}.\n */\nexport interface IFindElevationAtPointOptions\n extends Omit<IRequestOptions, \"httpMethod\" | \"f\">,\n queryParams {}\n\n/**\n * This method returns the elevation in meters at a given longitude and latitude\n * within the WGS84 coordinate system. By default the elevation is measured with\n * respect to the Earth's mean sea level. It takes into account the local\n * variations in gravity and provides a consistent vertical reference.\n *\n * If the relativeTo query parameter is set to `ellipsoid`, the elevation will be\n * measured with respect to the ellipsoid. This is a mathematical model that\n * approximates the shape of the Earth. It does not consider local variations\n * in gravity and is commonly used in GPS positioning.\n *\n * ```\n * import { findElevationAtPoint } from \"@esri/arcgis-rest-elevation\";\n * import { ApiKeyManager } from \"@esri/arcgis-rest-request\";\n *\n * const results = await findElevationAtPoint({\n * lon: -179.99,\n * lat: -85.05,\n * authentication: ApiKeyManager.fromKey(\"YOUR_ACCESS_TOKEN\");\n * });\n *\n * console.log(results)\n * ```\n */\nexport function findElevationAtPoint(\n requestOptions: IFindElevationAtPointOptions\n): Promise<IFindElevationAtPointResponse> {\n const options = appendCustomParams<IFindElevationAtPointOptions>(\n requestOptions,\n [\"lon\", \"lat\", \"relativeTo\"],\n {\n ...requestOptions\n }\n );\n\n return (\n request(`${baseUrl}/elevation/at-point`, {\n ...options,\n httpMethod: \"GET\"\n }) as Promise<successResponse>\n ).then((response) => {\n const r: IFindElevationAtPointResponse = {\n ...response\n };\n\n return r;\n });\n}\n","import {\n request,\n appendCustomParams,\n IRequestOptions\n} from \"@esri/arcgis-rest-request\";\n\nimport { operations } from \"./openapi-types.js\";\nimport { baseUrl } from \"./utils.js\";\n\n// determine the list of allowed params we want to allow as options\n// this should match the array given to appendCustomParams below\ntype queryParams = Pick<\n operations[\"ElevationAtManyPointsPost\"][\"requestBody\"][\"content\"][\"application/json\"],\n \"coordinates\" | \"relativeTo\"\n>;\n\n// get the correct type of the response format\ntype successResponse =\n operations[\"ElevationAtManyPointsPost\"][\"responses\"][\"200\"][\"content\"][\"application/json\"];\n\n/**\n * The response format for {@linkcode findElevationAtPoint};\n */\nexport interface IFindElevationAtManyPointsResponse extends successResponse {}\n\n/**\n * Options for {@linkcode findElevationAtPoint}.\n */\nexport interface IFindElevationAtManyPointsOptions\n extends Omit<IRequestOptions, \"httpMethod\" | \"f\">,\n queryParams {}\n\n/**\n * This method returns elevations in meters at given longitudes and latitudes\n * within the WGS84 coordinate system. The order of the points returned by this\n * request will be the same as the order of the points passed in the coordinates\n * parameter.\n *\n * If the distance between the furthest West and furthest East coordinate or\n * the furthest North and furthest South coordinate exceeds 50km, the service\n * will return a 400 HTTP response as the distance between these points is too\n * large.\n *\n * By default the elevation is measured with respect to the Earth's mean sea level.\n * It takes into account the local variations in gravity and provides a consistent\n * vertical reference.\n *\n * If the relativeTo query parameter is set to `ellipsoid`, the elevation will be\n * measured with respect to the ellipsoid. This is a mathematical model that\n * approximates the shape of the Earth. It does not consider local variations\n * in gravity and is commonly used in GPS positioning.\n *\n * ```\n * import { findElevationAtManyPoints } from \"@esri/arcgis-rest-elevation\";\n * import { ApiKeyManager } from \"@esri/arcgis-rest-request\";\n *\n * const results = await findElevationAtManyPoints({\n * coordinates: [[31.134167, 29.979167], [31.130833, 29.976111], [31.128333, 29.9725]],\n * authentication: ApiKeyManager.fromKey(\"YOUR_ACCESS_TOKEN\");\n * });\n *\n * console.log(results)\n * ```\n */\nexport function findElevationAtManyPoints(\n requestOptions: IFindElevationAtManyPointsOptions\n): Promise<IFindElevationAtManyPointsResponse> {\n const options: any = appendCustomParams<IFindElevationAtManyPointsOptions>(\n requestOptions,\n [\"relativeTo\"],\n {\n ...requestOptions\n }\n );\n\n options.params.coordinates = JSON.stringify(requestOptions.coordinates);\n\n return (\n request(`${baseUrl}/elevation/at-many-points`, {\n ...options\n }) as Promise<successResponse>\n ).then((response) => {\n const r: IFindElevationAtManyPointsResponse = {\n ...response\n };\n\n return r;\n });\n}\n"],"names":[],"mappings":";;;;;;;AAAO,MAAM,OAAO,GAClB,4EAA4E;;AC+B9E;;;;;;;;;;;;;;;;;;;;;;;;SAwBgB,oBAAoB,CAClC,cAA4C;IAE5C,MAAM,OAAO,GAAG,kBAAkB,CAChC,cAAc,EACd,CAAC,KAAK,EAAE,KAAK,EAAE,YAAY,CAAC,oBAEvB,cAAc,EAEpB,CAAC;IAEF,OACE,OAAO,CAAC,GAAG,OAAO,qBAAqB,kCAClC,OAAO,KACV,UAAU,EAAE,KAAK,IAEpB,CAAC,IAAI,CAAC,CAAC,QAAQ;QACd,MAAM,CAAC,qBACF,QAAQ,CACZ,CAAC;QAEF,OAAO,CAAC,CAAC;KACV,CAAC,CAAC;AACL;;AC/CA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;SAgCgB,yBAAyB,CACvC,cAAiD;IAEjD,MAAM,OAAO,GAAQ,kBAAkB,CACrC,cAAc,EACd,CAAC,YAAY,CAAC,oBAET,cAAc,EAEpB,CAAC;IAEF,OAAO,CAAC,MAAM,CAAC,WAAW,GAAG,IAAI,CAAC,SAAS,CAAC,cAAc,CAAC,WAAW,CAAC,CAAC;IAExE,OACE,OAAO,CAAC,GAAG,OAAO,2BAA2B,oBACxC,OAAO,EAEb,CAAC,IAAI,CAAC,CAAC,QAAQ;QACd,MAAM,CAAC,qBACF,QAAQ,CACZ,CAAC;QAEF,OAAO,CAAC,CAAC;KACV,CAAC,CAAC;AACL;;;;"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/* @preserve
|
|
2
|
+
* @esri/arcgis-rest-elevation - v1.0.0 - Apache-2.0
|
|
3
|
+
* Copyright (c) 2017-2025 Esri, Inc.
|
|
4
|
+
* Thu Jan 30 2025 15:44:10 GMT+0000 (Coordinated Universal Time)
|
|
5
|
+
*/
|
|
6
|
+
import{appendCustomParams as t,request as e}from"@esri/arcgis-rest-request";const s="https://elevation-api.arcgis.com/arcgis/rest/services/elevation-service/v1";function i(i){const n=t(i,["lon","lat","relativeTo"],Object.assign({},i));return e(`${s}/elevation/at-point`,Object.assign(Object.assign({},n),{httpMethod:"GET"})).then((t=>Object.assign({},t)))}function n(i){const n=t(i,["relativeTo"],Object.assign({},i));return n.params.coordinates=JSON.stringify(i.coordinates),e(`${s}/elevation/at-many-points`,Object.assign({},n)).then((t=>Object.assign({},t)))}export{n as findElevationAtManyPoints,i as findElevationAtPoint};
|
|
7
|
+
//# sourceMappingURL=elevation.esm.min.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"elevation.esm.min.js","sources":["../../src/utils.ts","../../src/findElevationAtPoint.ts","../../src/findElevationAtManyPoints.ts"],"sourcesContent":["export const baseUrl =\n \"https://elevation-api.arcgis.com/arcgis/rest/services/elevation-service/v1\";\n","import {\n request,\n appendCustomParams,\n IRequestOptions\n} from \"@esri/arcgis-rest-request\";\n\nimport { operations } from \"./openapi-types.js\";\nimport { baseUrl } from \"./utils.js\";\n\n// determine the list of allowed params we want to allow as options\n// this should match the array given to appendCustomParams below\ntype queryParams = Pick<\n operations[\"ElevationAtPointGet\"][\"parameters\"][\"query\"],\n \"lon\" | \"lat\" | \"relativeTo\"\n>;\n\n// get the correct type of the response format\ntype successResponse =\n operations[\"ElevationAtPointGet\"][\"responses\"][\"200\"][\"content\"][\"application/json\"];\n\n/**\n * The response format for {@linkcode findElevationAtPoint};\n */\nexport interface IFindElevationAtPointResponse extends successResponse {}\n\n/**\n * Options for {@linkcode findElevationAtPoint}.\n */\nexport interface IFindElevationAtPointOptions\n extends Omit<IRequestOptions, \"httpMethod\" | \"f\">,\n queryParams {}\n\n/**\n * This method returns the elevation in meters at a given longitude and latitude\n * within the WGS84 coordinate system. By default the elevation is measured with\n * respect to the Earth's mean sea level. It takes into account the local\n * variations in gravity and provides a consistent vertical reference.\n *\n * If the relativeTo query parameter is set to `ellipsoid`, the elevation will be\n * measured with respect to the ellipsoid. This is a mathematical model that\n * approximates the shape of the Earth. It does not consider local variations\n * in gravity and is commonly used in GPS positioning.\n *\n * ```\n * import { findElevationAtPoint } from \"@esri/arcgis-rest-elevation\";\n * import { ApiKeyManager } from \"@esri/arcgis-rest-request\";\n *\n * const results = await findElevationAtPoint({\n * lon: -179.99,\n * lat: -85.05,\n * authentication: ApiKeyManager.fromKey(\"YOUR_ACCESS_TOKEN\");\n * });\n *\n * console.log(results)\n * ```\n */\nexport function findElevationAtPoint(\n requestOptions: IFindElevationAtPointOptions\n): Promise<IFindElevationAtPointResponse> {\n const options = appendCustomParams<IFindElevationAtPointOptions>(\n requestOptions,\n [\"lon\", \"lat\", \"relativeTo\"],\n {\n ...requestOptions\n }\n );\n\n return (\n request(`${baseUrl}/elevation/at-point`, {\n ...options,\n httpMethod: \"GET\"\n }) as Promise<successResponse>\n ).then((response) => {\n const r: IFindElevationAtPointResponse = {\n ...response\n };\n\n return r;\n });\n}\n","import {\n request,\n appendCustomParams,\n IRequestOptions\n} from \"@esri/arcgis-rest-request\";\n\nimport { operations } from \"./openapi-types.js\";\nimport { baseUrl } from \"./utils.js\";\n\n// determine the list of allowed params we want to allow as options\n// this should match the array given to appendCustomParams below\ntype queryParams = Pick<\n operations[\"ElevationAtManyPointsPost\"][\"requestBody\"][\"content\"][\"application/json\"],\n \"coordinates\" | \"relativeTo\"\n>;\n\n// get the correct type of the response format\ntype successResponse =\n operations[\"ElevationAtManyPointsPost\"][\"responses\"][\"200\"][\"content\"][\"application/json\"];\n\n/**\n * The response format for {@linkcode findElevationAtPoint};\n */\nexport interface IFindElevationAtManyPointsResponse extends successResponse {}\n\n/**\n * Options for {@linkcode findElevationAtPoint}.\n */\nexport interface IFindElevationAtManyPointsOptions\n extends Omit<IRequestOptions, \"httpMethod\" | \"f\">,\n queryParams {}\n\n/**\n * This method returns elevations in meters at given longitudes and latitudes\n * within the WGS84 coordinate system. The order of the points returned by this\n * request will be the same as the order of the points passed in the coordinates\n * parameter.\n *\n * If the distance between the furthest West and furthest East coordinate or\n * the furthest North and furthest South coordinate exceeds 50km, the service\n * will return a 400 HTTP response as the distance between these points is too\n * large.\n *\n * By default the elevation is measured with respect to the Earth's mean sea level.\n * It takes into account the local variations in gravity and provides a consistent\n * vertical reference.\n *\n * If the relativeTo query parameter is set to `ellipsoid`, the elevation will be\n * measured with respect to the ellipsoid. This is a mathematical model that\n * approximates the shape of the Earth. It does not consider local variations\n * in gravity and is commonly used in GPS positioning.\n *\n * ```\n * import { findElevationAtManyPoints } from \"@esri/arcgis-rest-elevation\";\n * import { ApiKeyManager } from \"@esri/arcgis-rest-request\";\n *\n * const results = await findElevationAtManyPoints({\n * coordinates: [[31.134167, 29.979167], [31.130833, 29.976111], [31.128333, 29.9725]],\n * authentication: ApiKeyManager.fromKey(\"YOUR_ACCESS_TOKEN\");\n * });\n *\n * console.log(results)\n * ```\n */\nexport function findElevationAtManyPoints(\n requestOptions: IFindElevationAtManyPointsOptions\n): Promise<IFindElevationAtManyPointsResponse> {\n const options: any = appendCustomParams<IFindElevationAtManyPointsOptions>(\n requestOptions,\n [\"relativeTo\"],\n {\n ...requestOptions\n }\n );\n\n options.params.coordinates = JSON.stringify(requestOptions.coordinates);\n\n return (\n request(`${baseUrl}/elevation/at-many-points`, {\n ...options\n }) as Promise<successResponse>\n ).then((response) => {\n const r: IFindElevationAtManyPointsResponse = {\n ...response\n };\n\n return r;\n });\n}\n"],"names":["baseUrl","findElevationAtPoint","requestOptions","options","appendCustomParams","request","httpMethod","then","response","findElevationAtManyPoints","params","coordinates","JSON","stringify"],"mappings":";;;;;4EAAO,MAAMA,EACX,sFCuDcC,EACdC,GAEA,MAAMC,EAAUC,EACdF,EACA,CAAC,MAAO,MAAO,+BAEVA,IAIP,OACEG,EAAQ,GAAGL,sDACNG,IACHG,WAAY,SAEdC,MAAMC,oBAEDA,IAKT,UCfgBC,EACdP,GAEA,MAAMC,EAAeC,EACnBF,EACA,CAAC,+BAEIA,IAMP,OAFAC,EAAQO,OAAOC,YAAcC,KAAKC,UAAUX,EAAeS,aAGzDN,EAAQ,GAAGL,8CACNG,IAELI,MAAMC,oBAEDA,IAKT"}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/* @preserve
|
|
2
|
+
* @esri/arcgis-rest-elevation - v1.0.0 - Apache-2.0
|
|
3
|
+
* Copyright (c) 2017-2025 Esri, Inc.
|
|
4
|
+
* Thu Jan 30 2025 15:44:10 GMT+0000 (Coordinated Universal Time)
|
|
5
|
+
*/
|
|
6
|
+
(function (global, factory) {
|
|
7
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@esri/arcgis-rest-request')) :
|
|
8
|
+
typeof define === 'function' && define.amd ? define(['exports', '@esri/arcgis-rest-request'], factory) :
|
|
9
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.arcgisRest = global.arcgisRest || {}, global.arcgisRest));
|
|
10
|
+
})(this, (function (exports, arcgisRestRequest) { 'use strict';
|
|
11
|
+
|
|
12
|
+
const baseUrl = "https://elevation-api.arcgis.com/arcgis/rest/services/elevation-service/v1";
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* This method returns the elevation in meters at a given longitude and latitude
|
|
16
|
+
* within the WGS84 coordinate system. By default the elevation is measured with
|
|
17
|
+
* respect to the Earth's mean sea level. It takes into account the local
|
|
18
|
+
* variations in gravity and provides a consistent vertical reference.
|
|
19
|
+
*
|
|
20
|
+
* If the relativeTo query parameter is set to `ellipsoid`, the elevation will be
|
|
21
|
+
* measured with respect to the ellipsoid. This is a mathematical model that
|
|
22
|
+
* approximates the shape of the Earth. It does not consider local variations
|
|
23
|
+
* in gravity and is commonly used in GPS positioning.
|
|
24
|
+
*
|
|
25
|
+
* ```
|
|
26
|
+
* import { findElevationAtPoint } from "@esri/arcgis-rest-elevation";
|
|
27
|
+
* import { ApiKeyManager } from "@esri/arcgis-rest-request";
|
|
28
|
+
*
|
|
29
|
+
* const results = await findElevationAtPoint({
|
|
30
|
+
* lon: -179.99,
|
|
31
|
+
* lat: -85.05,
|
|
32
|
+
* authentication: ApiKeyManager.fromKey("YOUR_ACCESS_TOKEN");
|
|
33
|
+
* });
|
|
34
|
+
*
|
|
35
|
+
* console.log(results)
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
38
|
+
function findElevationAtPoint(requestOptions) {
|
|
39
|
+
const options = arcgisRestRequest.appendCustomParams(requestOptions, ["lon", "lat", "relativeTo"], Object.assign({}, requestOptions));
|
|
40
|
+
return arcgisRestRequest.request(`${baseUrl}/elevation/at-point`, Object.assign(Object.assign({}, options), { httpMethod: "GET" })).then((response) => {
|
|
41
|
+
const r = Object.assign({}, response);
|
|
42
|
+
return r;
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* This method returns elevations in meters at given longitudes and latitudes
|
|
48
|
+
* within the WGS84 coordinate system. The order of the points returned by this
|
|
49
|
+
* request will be the same as the order of the points passed in the coordinates
|
|
50
|
+
* parameter.
|
|
51
|
+
*
|
|
52
|
+
* If the distance between the furthest West and furthest East coordinate or
|
|
53
|
+
* the furthest North and furthest South coordinate exceeds 50km, the service
|
|
54
|
+
* will return a 400 HTTP response as the distance between these points is too
|
|
55
|
+
* large.
|
|
56
|
+
*
|
|
57
|
+
* By default the elevation is measured with respect to the Earth's mean sea level.
|
|
58
|
+
* It takes into account the local variations in gravity and provides a consistent
|
|
59
|
+
* vertical reference.
|
|
60
|
+
*
|
|
61
|
+
* If the relativeTo query parameter is set to `ellipsoid`, the elevation will be
|
|
62
|
+
* measured with respect to the ellipsoid. This is a mathematical model that
|
|
63
|
+
* approximates the shape of the Earth. It does not consider local variations
|
|
64
|
+
* in gravity and is commonly used in GPS positioning.
|
|
65
|
+
*
|
|
66
|
+
* ```
|
|
67
|
+
* import { findElevationAtManyPoints } from "@esri/arcgis-rest-elevation";
|
|
68
|
+
* import { ApiKeyManager } from "@esri/arcgis-rest-request";
|
|
69
|
+
*
|
|
70
|
+
* const results = await findElevationAtManyPoints({
|
|
71
|
+
* coordinates: [[31.134167, 29.979167], [31.130833, 29.976111], [31.128333, 29.9725]],
|
|
72
|
+
* authentication: ApiKeyManager.fromKey("YOUR_ACCESS_TOKEN");
|
|
73
|
+
* });
|
|
74
|
+
*
|
|
75
|
+
* console.log(results)
|
|
76
|
+
* ```
|
|
77
|
+
*/
|
|
78
|
+
function findElevationAtManyPoints(requestOptions) {
|
|
79
|
+
const options = arcgisRestRequest.appendCustomParams(requestOptions, ["relativeTo"], Object.assign({}, requestOptions));
|
|
80
|
+
options.params.coordinates = JSON.stringify(requestOptions.coordinates);
|
|
81
|
+
return arcgisRestRequest.request(`${baseUrl}/elevation/at-many-points`, Object.assign({}, options)).then((response) => {
|
|
82
|
+
const r = Object.assign({}, response);
|
|
83
|
+
return r;
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
exports.findElevationAtManyPoints = findElevationAtManyPoints;
|
|
88
|
+
exports.findElevationAtPoint = findElevationAtPoint;
|
|
89
|
+
|
|
90
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
91
|
+
|
|
92
|
+
}));
|
|
93
|
+
//# sourceMappingURL=elevation.umd.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"elevation.umd.js","sources":["../../src/utils.ts","../../src/findElevationAtPoint.ts","../../src/findElevationAtManyPoints.ts"],"sourcesContent":["export const baseUrl =\n \"https://elevation-api.arcgis.com/arcgis/rest/services/elevation-service/v1\";\n","import {\n request,\n appendCustomParams,\n IRequestOptions\n} from \"@esri/arcgis-rest-request\";\n\nimport { operations } from \"./openapi-types.js\";\nimport { baseUrl } from \"./utils.js\";\n\n// determine the list of allowed params we want to allow as options\n// this should match the array given to appendCustomParams below\ntype queryParams = Pick<\n operations[\"ElevationAtPointGet\"][\"parameters\"][\"query\"],\n \"lon\" | \"lat\" | \"relativeTo\"\n>;\n\n// get the correct type of the response format\ntype successResponse =\n operations[\"ElevationAtPointGet\"][\"responses\"][\"200\"][\"content\"][\"application/json\"];\n\n/**\n * The response format for {@linkcode findElevationAtPoint};\n */\nexport interface IFindElevationAtPointResponse extends successResponse {}\n\n/**\n * Options for {@linkcode findElevationAtPoint}.\n */\nexport interface IFindElevationAtPointOptions\n extends Omit<IRequestOptions, \"httpMethod\" | \"f\">,\n queryParams {}\n\n/**\n * This method returns the elevation in meters at a given longitude and latitude\n * within the WGS84 coordinate system. By default the elevation is measured with\n * respect to the Earth's mean sea level. It takes into account the local\n * variations in gravity and provides a consistent vertical reference.\n *\n * If the relativeTo query parameter is set to `ellipsoid`, the elevation will be\n * measured with respect to the ellipsoid. This is a mathematical model that\n * approximates the shape of the Earth. It does not consider local variations\n * in gravity and is commonly used in GPS positioning.\n *\n * ```\n * import { findElevationAtPoint } from \"@esri/arcgis-rest-elevation\";\n * import { ApiKeyManager } from \"@esri/arcgis-rest-request\";\n *\n * const results = await findElevationAtPoint({\n * lon: -179.99,\n * lat: -85.05,\n * authentication: ApiKeyManager.fromKey(\"YOUR_ACCESS_TOKEN\");\n * });\n *\n * console.log(results)\n * ```\n */\nexport function findElevationAtPoint(\n requestOptions: IFindElevationAtPointOptions\n): Promise<IFindElevationAtPointResponse> {\n const options = appendCustomParams<IFindElevationAtPointOptions>(\n requestOptions,\n [\"lon\", \"lat\", \"relativeTo\"],\n {\n ...requestOptions\n }\n );\n\n return (\n request(`${baseUrl}/elevation/at-point`, {\n ...options,\n httpMethod: \"GET\"\n }) as Promise<successResponse>\n ).then((response) => {\n const r: IFindElevationAtPointResponse = {\n ...response\n };\n\n return r;\n });\n}\n","import {\n request,\n appendCustomParams,\n IRequestOptions\n} from \"@esri/arcgis-rest-request\";\n\nimport { operations } from \"./openapi-types.js\";\nimport { baseUrl } from \"./utils.js\";\n\n// determine the list of allowed params we want to allow as options\n// this should match the array given to appendCustomParams below\ntype queryParams = Pick<\n operations[\"ElevationAtManyPointsPost\"][\"requestBody\"][\"content\"][\"application/json\"],\n \"coordinates\" | \"relativeTo\"\n>;\n\n// get the correct type of the response format\ntype successResponse =\n operations[\"ElevationAtManyPointsPost\"][\"responses\"][\"200\"][\"content\"][\"application/json\"];\n\n/**\n * The response format for {@linkcode findElevationAtPoint};\n */\nexport interface IFindElevationAtManyPointsResponse extends successResponse {}\n\n/**\n * Options for {@linkcode findElevationAtPoint}.\n */\nexport interface IFindElevationAtManyPointsOptions\n extends Omit<IRequestOptions, \"httpMethod\" | \"f\">,\n queryParams {}\n\n/**\n * This method returns elevations in meters at given longitudes and latitudes\n * within the WGS84 coordinate system. The order of the points returned by this\n * request will be the same as the order of the points passed in the coordinates\n * parameter.\n *\n * If the distance between the furthest West and furthest East coordinate or\n * the furthest North and furthest South coordinate exceeds 50km, the service\n * will return a 400 HTTP response as the distance between these points is too\n * large.\n *\n * By default the elevation is measured with respect to the Earth's mean sea level.\n * It takes into account the local variations in gravity and provides a consistent\n * vertical reference.\n *\n * If the relativeTo query parameter is set to `ellipsoid`, the elevation will be\n * measured with respect to the ellipsoid. This is a mathematical model that\n * approximates the shape of the Earth. It does not consider local variations\n * in gravity and is commonly used in GPS positioning.\n *\n * ```\n * import { findElevationAtManyPoints } from \"@esri/arcgis-rest-elevation\";\n * import { ApiKeyManager } from \"@esri/arcgis-rest-request\";\n *\n * const results = await findElevationAtManyPoints({\n * coordinates: [[31.134167, 29.979167], [31.130833, 29.976111], [31.128333, 29.9725]],\n * authentication: ApiKeyManager.fromKey(\"YOUR_ACCESS_TOKEN\");\n * });\n *\n * console.log(results)\n * ```\n */\nexport function findElevationAtManyPoints(\n requestOptions: IFindElevationAtManyPointsOptions\n): Promise<IFindElevationAtManyPointsResponse> {\n const options: any = appendCustomParams<IFindElevationAtManyPointsOptions>(\n requestOptions,\n [\"relativeTo\"],\n {\n ...requestOptions\n }\n );\n\n options.params.coordinates = JSON.stringify(requestOptions.coordinates);\n\n return (\n request(`${baseUrl}/elevation/at-many-points`, {\n ...options\n }) as Promise<successResponse>\n ).then((response) => {\n const r: IFindElevationAtManyPointsResponse = {\n ...response\n };\n\n return r;\n });\n}\n"],"names":["appendCustomParams","request"],"mappings":";;;;;;;;;;;EAAO,MAAM,OAAO,GAClB,4EAA4E;;EC+B9E;;;;;;;;;;;;;;;;;;;;;;;;WAwBgB,oBAAoB,CAClC,cAA4C;MAE5C,MAAM,OAAO,GAAGA,oCAAkB,CAChC,cAAc,EACd,CAAC,KAAK,EAAE,KAAK,EAAE,YAAY,CAAC,oBAEvB,cAAc,EAEpB,CAAC;MAEF,OACEC,yBAAO,CAAC,GAAG,OAAO,qBAAqB,kCAClC,OAAO,KACV,UAAU,EAAE,KAAK,IAEpB,CAAC,IAAI,CAAC,CAAC,QAAQ;UACd,MAAM,CAAC,qBACF,QAAQ,CACZ,CAAC;UAEF,OAAO,CAAC,CAAC;OACV,CAAC,CAAC;EACL;;EC/CA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;WAgCgB,yBAAyB,CACvC,cAAiD;MAEjD,MAAM,OAAO,GAAQD,oCAAkB,CACrC,cAAc,EACd,CAAC,YAAY,CAAC,oBAET,cAAc,EAEpB,CAAC;MAEF,OAAO,CAAC,MAAM,CAAC,WAAW,GAAG,IAAI,CAAC,SAAS,CAAC,cAAc,CAAC,WAAW,CAAC,CAAC;MAExE,OACEC,yBAAO,CAAC,GAAG,OAAO,2BAA2B,oBACxC,OAAO,EAEb,CAAC,IAAI,CAAC,CAAC,QAAQ;UACd,MAAM,CAAC,qBACF,QAAQ,CACZ,CAAC;UAEF,OAAO,CAAC,CAAC;OACV,CAAC,CAAC;EACL;;;;;;;;;;;"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/* @preserve
|
|
2
|
+
* @esri/arcgis-rest-elevation - v1.0.0 - Apache-2.0
|
|
3
|
+
* Copyright (c) 2017-2025 Esri, Inc.
|
|
4
|
+
* Thu Jan 30 2025 15:44:10 GMT+0000 (Coordinated Universal Time)
|
|
5
|
+
*/
|
|
6
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@esri/arcgis-rest-request")):"function"==typeof define&&define.amd?define(["exports","@esri/arcgis-rest-request"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).arcgisRest=e.arcgisRest||{},e.arcgisRest)}(this,(function(e,t){"use strict";const s="https://elevation-api.arcgis.com/arcgis/rest/services/elevation-service/v1";e.findElevationAtManyPoints=function(e){const i=t.appendCustomParams(e,["relativeTo"],Object.assign({},e));return i.params.coordinates=JSON.stringify(e.coordinates),t.request(`${s}/elevation/at-many-points`,Object.assign({},i)).then((e=>Object.assign({},e)))},e.findElevationAtPoint=function(e){const i=t.appendCustomParams(e,["lon","lat","relativeTo"],Object.assign({},e));return t.request(`${s}/elevation/at-point`,Object.assign(Object.assign({},i),{httpMethod:"GET"})).then((e=>Object.assign({},e)))},Object.defineProperty(e,"__esModule",{value:!0})}));
|
|
7
|
+
//# sourceMappingURL=elevation.umd.min.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"elevation.umd.min.js","sources":["../../src/utils.ts","../../src/findElevationAtManyPoints.ts","../../src/findElevationAtPoint.ts"],"sourcesContent":["export const baseUrl =\n \"https://elevation-api.arcgis.com/arcgis/rest/services/elevation-service/v1\";\n","import {\n request,\n appendCustomParams,\n IRequestOptions\n} from \"@esri/arcgis-rest-request\";\n\nimport { operations } from \"./openapi-types.js\";\nimport { baseUrl } from \"./utils.js\";\n\n// determine the list of allowed params we want to allow as options\n// this should match the array given to appendCustomParams below\ntype queryParams = Pick<\n operations[\"ElevationAtManyPointsPost\"][\"requestBody\"][\"content\"][\"application/json\"],\n \"coordinates\" | \"relativeTo\"\n>;\n\n// get the correct type of the response format\ntype successResponse =\n operations[\"ElevationAtManyPointsPost\"][\"responses\"][\"200\"][\"content\"][\"application/json\"];\n\n/**\n * The response format for {@linkcode findElevationAtPoint};\n */\nexport interface IFindElevationAtManyPointsResponse extends successResponse {}\n\n/**\n * Options for {@linkcode findElevationAtPoint}.\n */\nexport interface IFindElevationAtManyPointsOptions\n extends Omit<IRequestOptions, \"httpMethod\" | \"f\">,\n queryParams {}\n\n/**\n * This method returns elevations in meters at given longitudes and latitudes\n * within the WGS84 coordinate system. The order of the points returned by this\n * request will be the same as the order of the points passed in the coordinates\n * parameter.\n *\n * If the distance between the furthest West and furthest East coordinate or\n * the furthest North and furthest South coordinate exceeds 50km, the service\n * will return a 400 HTTP response as the distance between these points is too\n * large.\n *\n * By default the elevation is measured with respect to the Earth's mean sea level.\n * It takes into account the local variations in gravity and provides a consistent\n * vertical reference.\n *\n * If the relativeTo query parameter is set to `ellipsoid`, the elevation will be\n * measured with respect to the ellipsoid. This is a mathematical model that\n * approximates the shape of the Earth. It does not consider local variations\n * in gravity and is commonly used in GPS positioning.\n *\n * ```\n * import { findElevationAtManyPoints } from \"@esri/arcgis-rest-elevation\";\n * import { ApiKeyManager } from \"@esri/arcgis-rest-request\";\n *\n * const results = await findElevationAtManyPoints({\n * coordinates: [[31.134167, 29.979167], [31.130833, 29.976111], [31.128333, 29.9725]],\n * authentication: ApiKeyManager.fromKey(\"YOUR_ACCESS_TOKEN\");\n * });\n *\n * console.log(results)\n * ```\n */\nexport function findElevationAtManyPoints(\n requestOptions: IFindElevationAtManyPointsOptions\n): Promise<IFindElevationAtManyPointsResponse> {\n const options: any = appendCustomParams<IFindElevationAtManyPointsOptions>(\n requestOptions,\n [\"relativeTo\"],\n {\n ...requestOptions\n }\n );\n\n options.params.coordinates = JSON.stringify(requestOptions.coordinates);\n\n return (\n request(`${baseUrl}/elevation/at-many-points`, {\n ...options\n }) as Promise<successResponse>\n ).then((response) => {\n const r: IFindElevationAtManyPointsResponse = {\n ...response\n };\n\n return r;\n });\n}\n","import {\n request,\n appendCustomParams,\n IRequestOptions\n} from \"@esri/arcgis-rest-request\";\n\nimport { operations } from \"./openapi-types.js\";\nimport { baseUrl } from \"./utils.js\";\n\n// determine the list of allowed params we want to allow as options\n// this should match the array given to appendCustomParams below\ntype queryParams = Pick<\n operations[\"ElevationAtPointGet\"][\"parameters\"][\"query\"],\n \"lon\" | \"lat\" | \"relativeTo\"\n>;\n\n// get the correct type of the response format\ntype successResponse =\n operations[\"ElevationAtPointGet\"][\"responses\"][\"200\"][\"content\"][\"application/json\"];\n\n/**\n * The response format for {@linkcode findElevationAtPoint};\n */\nexport interface IFindElevationAtPointResponse extends successResponse {}\n\n/**\n * Options for {@linkcode findElevationAtPoint}.\n */\nexport interface IFindElevationAtPointOptions\n extends Omit<IRequestOptions, \"httpMethod\" | \"f\">,\n queryParams {}\n\n/**\n * This method returns the elevation in meters at a given longitude and latitude\n * within the WGS84 coordinate system. By default the elevation is measured with\n * respect to the Earth's mean sea level. It takes into account the local\n * variations in gravity and provides a consistent vertical reference.\n *\n * If the relativeTo query parameter is set to `ellipsoid`, the elevation will be\n * measured with respect to the ellipsoid. This is a mathematical model that\n * approximates the shape of the Earth. It does not consider local variations\n * in gravity and is commonly used in GPS positioning.\n *\n * ```\n * import { findElevationAtPoint } from \"@esri/arcgis-rest-elevation\";\n * import { ApiKeyManager } from \"@esri/arcgis-rest-request\";\n *\n * const results = await findElevationAtPoint({\n * lon: -179.99,\n * lat: -85.05,\n * authentication: ApiKeyManager.fromKey(\"YOUR_ACCESS_TOKEN\");\n * });\n *\n * console.log(results)\n * ```\n */\nexport function findElevationAtPoint(\n requestOptions: IFindElevationAtPointOptions\n): Promise<IFindElevationAtPointResponse> {\n const options = appendCustomParams<IFindElevationAtPointOptions>(\n requestOptions,\n [\"lon\", \"lat\", \"relativeTo\"],\n {\n ...requestOptions\n }\n );\n\n return (\n request(`${baseUrl}/elevation/at-point`, {\n ...options,\n httpMethod: \"GET\"\n }) as Promise<successResponse>\n ).then((response) => {\n const r: IFindElevationAtPointResponse = {\n ...response\n };\n\n return r;\n });\n}\n"],"names":["baseUrl","requestOptions","options","appendCustomParams","params","coordinates","JSON","stringify","request","then","response","httpMethod"],"mappings":";;;;;gVAAO,MAAMA,EACX,kHCgEAC,GAEA,MAAMC,EAAeC,qBACnBF,EACA,CAAC,+BAEIA,IAMP,OAFAC,EAAQE,OAAOC,YAAcC,KAAKC,UAAUN,EAAeI,aAGzDG,UAAQ,GAAGR,8CACNE,IAELO,MAAMC,oBAEDA,IAKT,kCC/BET,GAEA,MAAMC,EAAUC,qBACdF,EACA,CAAC,MAAO,MAAO,+BAEVA,IAIP,OACEO,UAAQ,GAAGR,sDACNE,IACHS,WAAY,SAEdF,MAAMC,oBAEDA,IAKT"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.findElevationAtManyPoints = void 0;
|
|
4
|
+
const arcgis_rest_request_1 = require("@esri/arcgis-rest-request");
|
|
5
|
+
const utils_js_1 = require("./utils.js");
|
|
6
|
+
/**
|
|
7
|
+
* This method returns elevations in meters at given longitudes and latitudes
|
|
8
|
+
* within the WGS84 coordinate system. The order of the points returned by this
|
|
9
|
+
* request will be the same as the order of the points passed in the coordinates
|
|
10
|
+
* parameter.
|
|
11
|
+
*
|
|
12
|
+
* If the distance between the furthest West and furthest East coordinate or
|
|
13
|
+
* the furthest North and furthest South coordinate exceeds 50km, the service
|
|
14
|
+
* will return a 400 HTTP response as the distance between these points is too
|
|
15
|
+
* large.
|
|
16
|
+
*
|
|
17
|
+
* By default the elevation is measured with respect to the Earth's mean sea level.
|
|
18
|
+
* It takes into account the local variations in gravity and provides a consistent
|
|
19
|
+
* vertical reference.
|
|
20
|
+
*
|
|
21
|
+
* If the relativeTo query parameter is set to `ellipsoid`, the elevation will be
|
|
22
|
+
* measured with respect to the ellipsoid. This is a mathematical model that
|
|
23
|
+
* approximates the shape of the Earth. It does not consider local variations
|
|
24
|
+
* in gravity and is commonly used in GPS positioning.
|
|
25
|
+
*
|
|
26
|
+
* ```
|
|
27
|
+
* import { findElevationAtManyPoints } from "@esri/arcgis-rest-elevation";
|
|
28
|
+
* import { ApiKeyManager } from "@esri/arcgis-rest-request";
|
|
29
|
+
*
|
|
30
|
+
* const results = await findElevationAtManyPoints({
|
|
31
|
+
* coordinates: [[31.134167, 29.979167], [31.130833, 29.976111], [31.128333, 29.9725]],
|
|
32
|
+
* authentication: ApiKeyManager.fromKey("YOUR_ACCESS_TOKEN");
|
|
33
|
+
* });
|
|
34
|
+
*
|
|
35
|
+
* console.log(results)
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
38
|
+
function findElevationAtManyPoints(requestOptions) {
|
|
39
|
+
const options = (0, arcgis_rest_request_1.appendCustomParams)(requestOptions, ["relativeTo"], Object.assign({}, requestOptions));
|
|
40
|
+
options.params.coordinates = JSON.stringify(requestOptions.coordinates);
|
|
41
|
+
return (0, arcgis_rest_request_1.request)(`${utils_js_1.baseUrl}/elevation/at-many-points`, Object.assign({}, options)).then((response) => {
|
|
42
|
+
const r = Object.assign({}, response);
|
|
43
|
+
return r;
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
exports.findElevationAtManyPoints = findElevationAtManyPoints;
|
|
47
|
+
//# sourceMappingURL=findElevationAtManyPoints.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"findElevationAtManyPoints.js","sourceRoot":"","sources":["../../src/findElevationAtManyPoints.ts"],"names":[],"mappings":";;;AAAA,mEAImC;AAGnC,yCAAqC;AAyBrC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,SAAgB,yBAAyB,CACvC,cAAiD;IAEjD,MAAM,OAAO,GAAQ,IAAA,wCAAkB,EACrC,cAAc,EACd,CAAC,YAAY,CAAC,oBAET,cAAc,EAEpB,CAAC;IAEF,OAAO,CAAC,MAAM,CAAC,WAAW,GAAG,IAAI,CAAC,SAAS,CAAC,cAAc,CAAC,WAAW,CAAC,CAAC;IAExE,OACE,IAAA,6BAAO,EAAC,GAAG,kBAAO,2BAA2B,oBACxC,OAAO,EAEb,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE;QAClB,MAAM,CAAC,qBACF,QAAQ,CACZ,CAAC;QAEF,OAAO,CAAC,CAAC;IACX,CAAC,CAAC,CAAC;AACL,CAAC;AAxBD,8DAwBC","sourcesContent":["import {\n request,\n appendCustomParams,\n IRequestOptions\n} from \"@esri/arcgis-rest-request\";\n\nimport { operations } from \"./openapi-types.js\";\nimport { baseUrl } from \"./utils.js\";\n\n// determine the list of allowed params we want to allow as options\n// this should match the array given to appendCustomParams below\ntype queryParams = Pick<\n operations[\"ElevationAtManyPointsPost\"][\"requestBody\"][\"content\"][\"application/json\"],\n \"coordinates\" | \"relativeTo\"\n>;\n\n// get the correct type of the response format\ntype successResponse =\n operations[\"ElevationAtManyPointsPost\"][\"responses\"][\"200\"][\"content\"][\"application/json\"];\n\n/**\n * The response format for {@linkcode findElevationAtPoint};\n */\nexport interface IFindElevationAtManyPointsResponse extends successResponse {}\n\n/**\n * Options for {@linkcode findElevationAtPoint}.\n */\nexport interface IFindElevationAtManyPointsOptions\n extends Omit<IRequestOptions, \"httpMethod\" | \"f\">,\n queryParams {}\n\n/**\n * This method returns elevations in meters at given longitudes and latitudes\n * within the WGS84 coordinate system. The order of the points returned by this\n * request will be the same as the order of the points passed in the coordinates\n * parameter.\n *\n * If the distance between the furthest West and furthest East coordinate or\n * the furthest North and furthest South coordinate exceeds 50km, the service\n * will return a 400 HTTP response as the distance between these points is too\n * large.\n *\n * By default the elevation is measured with respect to the Earth's mean sea level.\n * It takes into account the local variations in gravity and provides a consistent\n * vertical reference.\n *\n * If the relativeTo query parameter is set to `ellipsoid`, the elevation will be\n * measured with respect to the ellipsoid. This is a mathematical model that\n * approximates the shape of the Earth. It does not consider local variations\n * in gravity and is commonly used in GPS positioning.\n *\n * ```\n * import { findElevationAtManyPoints } from \"@esri/arcgis-rest-elevation\";\n * import { ApiKeyManager } from \"@esri/arcgis-rest-request\";\n *\n * const results = await findElevationAtManyPoints({\n * coordinates: [[31.134167, 29.979167], [31.130833, 29.976111], [31.128333, 29.9725]],\n * authentication: ApiKeyManager.fromKey(\"YOUR_ACCESS_TOKEN\");\n * });\n *\n * console.log(results)\n * ```\n */\nexport function findElevationAtManyPoints(\n requestOptions: IFindElevationAtManyPointsOptions\n): Promise<IFindElevationAtManyPointsResponse> {\n const options: any = appendCustomParams<IFindElevationAtManyPointsOptions>(\n requestOptions,\n [\"relativeTo\"],\n {\n ...requestOptions\n }\n );\n\n options.params.coordinates = JSON.stringify(requestOptions.coordinates);\n\n return (\n request(`${baseUrl}/elevation/at-many-points`, {\n ...options\n }) as Promise<successResponse>\n ).then((response) => {\n const r: IFindElevationAtManyPointsResponse = {\n ...response\n };\n\n return r;\n });\n}\n"]}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.findElevationAtPoint = void 0;
|
|
4
|
+
const arcgis_rest_request_1 = require("@esri/arcgis-rest-request");
|
|
5
|
+
const utils_js_1 = require("./utils.js");
|
|
6
|
+
/**
|
|
7
|
+
* This method returns the elevation in meters at a given longitude and latitude
|
|
8
|
+
* within the WGS84 coordinate system. By default the elevation is measured with
|
|
9
|
+
* respect to the Earth's mean sea level. It takes into account the local
|
|
10
|
+
* variations in gravity and provides a consistent vertical reference.
|
|
11
|
+
*
|
|
12
|
+
* If the relativeTo query parameter is set to `ellipsoid`, the elevation will be
|
|
13
|
+
* measured with respect to the ellipsoid. This is a mathematical model that
|
|
14
|
+
* approximates the shape of the Earth. It does not consider local variations
|
|
15
|
+
* in gravity and is commonly used in GPS positioning.
|
|
16
|
+
*
|
|
17
|
+
* ```
|
|
18
|
+
* import { findElevationAtPoint } from "@esri/arcgis-rest-elevation";
|
|
19
|
+
* import { ApiKeyManager } from "@esri/arcgis-rest-request";
|
|
20
|
+
*
|
|
21
|
+
* const results = await findElevationAtPoint({
|
|
22
|
+
* lon: -179.99,
|
|
23
|
+
* lat: -85.05,
|
|
24
|
+
* authentication: ApiKeyManager.fromKey("YOUR_ACCESS_TOKEN");
|
|
25
|
+
* });
|
|
26
|
+
*
|
|
27
|
+
* console.log(results)
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
function findElevationAtPoint(requestOptions) {
|
|
31
|
+
const options = (0, arcgis_rest_request_1.appendCustomParams)(requestOptions, ["lon", "lat", "relativeTo"], Object.assign({}, requestOptions));
|
|
32
|
+
return (0, arcgis_rest_request_1.request)(`${utils_js_1.baseUrl}/elevation/at-point`, Object.assign(Object.assign({}, options), { httpMethod: "GET" })).then((response) => {
|
|
33
|
+
const r = Object.assign({}, response);
|
|
34
|
+
return r;
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
exports.findElevationAtPoint = findElevationAtPoint;
|
|
38
|
+
//# sourceMappingURL=findElevationAtPoint.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"findElevationAtPoint.js","sourceRoot":"","sources":["../../src/findElevationAtPoint.ts"],"names":[],"mappings":";;;AAAA,mEAImC;AAGnC,yCAAqC;AAyBrC;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,SAAgB,oBAAoB,CAClC,cAA4C;IAE5C,MAAM,OAAO,GAAG,IAAA,wCAAkB,EAChC,cAAc,EACd,CAAC,KAAK,EAAE,KAAK,EAAE,YAAY,CAAC,oBAEvB,cAAc,EAEpB,CAAC;IAEF,OACE,IAAA,6BAAO,EAAC,GAAG,kBAAO,qBAAqB,kCAClC,OAAO,KACV,UAAU,EAAE,KAAK,IAEpB,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE;QAClB,MAAM,CAAC,qBACF,QAAQ,CACZ,CAAC;QAEF,OAAO,CAAC,CAAC;IACX,CAAC,CAAC,CAAC;AACL,CAAC;AAvBD,oDAuBC","sourcesContent":["import {\n request,\n appendCustomParams,\n IRequestOptions\n} from \"@esri/arcgis-rest-request\";\n\nimport { operations } from \"./openapi-types.js\";\nimport { baseUrl } from \"./utils.js\";\n\n// determine the list of allowed params we want to allow as options\n// this should match the array given to appendCustomParams below\ntype queryParams = Pick<\n operations[\"ElevationAtPointGet\"][\"parameters\"][\"query\"],\n \"lon\" | \"lat\" | \"relativeTo\"\n>;\n\n// get the correct type of the response format\ntype successResponse =\n operations[\"ElevationAtPointGet\"][\"responses\"][\"200\"][\"content\"][\"application/json\"];\n\n/**\n * The response format for {@linkcode findElevationAtPoint};\n */\nexport interface IFindElevationAtPointResponse extends successResponse {}\n\n/**\n * Options for {@linkcode findElevationAtPoint}.\n */\nexport interface IFindElevationAtPointOptions\n extends Omit<IRequestOptions, \"httpMethod\" | \"f\">,\n queryParams {}\n\n/**\n * This method returns the elevation in meters at a given longitude and latitude\n * within the WGS84 coordinate system. By default the elevation is measured with\n * respect to the Earth's mean sea level. It takes into account the local\n * variations in gravity and provides a consistent vertical reference.\n *\n * If the relativeTo query parameter is set to `ellipsoid`, the elevation will be\n * measured with respect to the ellipsoid. This is a mathematical model that\n * approximates the shape of the Earth. It does not consider local variations\n * in gravity and is commonly used in GPS positioning.\n *\n * ```\n * import { findElevationAtPoint } from \"@esri/arcgis-rest-elevation\";\n * import { ApiKeyManager } from \"@esri/arcgis-rest-request\";\n *\n * const results = await findElevationAtPoint({\n * lon: -179.99,\n * lat: -85.05,\n * authentication: ApiKeyManager.fromKey(\"YOUR_ACCESS_TOKEN\");\n * });\n *\n * console.log(results)\n * ```\n */\nexport function findElevationAtPoint(\n requestOptions: IFindElevationAtPointOptions\n): Promise<IFindElevationAtPointResponse> {\n const options = appendCustomParams<IFindElevationAtPointOptions>(\n requestOptions,\n [\"lon\", \"lat\", \"relativeTo\"],\n {\n ...requestOptions\n }\n );\n\n return (\n request(`${baseUrl}/elevation/at-point`, {\n ...options,\n httpMethod: \"GET\"\n }) as Promise<successResponse>\n ).then((response) => {\n const r: IFindElevationAtPointResponse = {\n ...response\n };\n\n return r;\n });\n}\n"]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* Copyright (c) 2023 Environmental Systems Research Institute, Inc.
|
|
3
|
+
* Apache-2.0 */
|
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
const tslib_1 = require("tslib");
|
|
6
|
+
(0, tslib_1.__exportStar)(require("./findElevationAtPoint.js"), exports);
|
|
7
|
+
(0, tslib_1.__exportStar)(require("./findElevationAtManyPoints.js"), exports);
|
|
8
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAAA;gBACgB;;;AAMhB,yEAA0C;AAC1C,8EAA+C","sourcesContent":["/* Copyright (c) 2023 Environmental Systems Research Institute, Inc.\n * Apache-2.0 */\n\n// Types that are used in this package are re-exported for convenience and\n// to make the links work correctly in the documentation pages.\nexport type {} from \"@esri/arcgis-rest-request\";\n\nexport * from \"./findElevationAtPoint.js\";\nexport * from \"./findElevationAtManyPoints.js\";\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"openapi-types.js","sourceRoot":"","sources":["../../src/openapi-types.ts"],"names":[],"mappings":";AAAA;;;GAGG","sourcesContent":["/**\n * This file was auto-generated by openapi-typescript.\n * Do not make direct changes to the file.\n */\n\nexport interface paths {\n \"/elevation/at-point\": {\n /**\n * Returns the elevation in meters at a given longitude and latitude within the WGS84 coordinate system.\n *\n * By default the elevation is measured with respect to the Earth's mean sea level. It takes into account the local variations in gravity and provides a consistent vertical reference.\n *\n * If the `relativeTo` query parameter is set to `ellipsoid`, the elevation will be measured with respect to the ellipsoid. This is a mathematical model that approximates the shape of the Earth. It does not consider local variations in gravity and is commonly used in GPS positioning.\n *\n * Note: You cannot permanently store elevations. Please see the [Terms of use](https://developers.arcgis.com/documentation/mapping-apis-and-services/deployment/terms-of-use/).\n */\n get: operations[\"ElevationAtPointGet\"];\n };\n \"/elevation/at-many-points\": {\n /**\n * Returns elevations in meters at given longitudes and latitudes within the WGS84 coordinate system.\n *\n * The order of the points returned by this request will be the same as the order of the points passed in the\n * `coordinates` parameter.\n *\n * If the distance between the furthest West and furthest East coordinate exceeds 50km, the service will return a `400` HTTP response as the distance between these points is too large.\n *\n * If the distance between the furthest North and furthest South coordinate exceeds 50km, the service will return a `400` HTTP response as the distance between these points is too large.\n *\n * If any of the points are otherwise invalid, a `400` HTTP response will be returned.\n *\n * By default the elevation is measured with respect to the Earth's mean sea level. It takes into account the local variations in gravity and provides a consistent vertical reference.\n *\n * If the `relativeTo` parameter in the body is set to `ellipsoid`, the elevation will be measured with respect to the ellipsoid. This is a mathematical model that approximates the shape of the Earth. It does not consider local variations in gravity and is commonly used in GPS positioning.\n *\n * Note: You cannot permanently store elevations. Please see the [Terms of use](https://developers.arcgis.com/documentation/mapping-apis-and-services/deployment/terms-of-use/).\n *\n * The Post Body content type must be either:\n * - JSON with content type of `application/json`, or\n * - form URL encoded key-value pairs with content type `application/x-www-form-urlencoded`.\n *\n * The following parameters are used to fetch elevations for multiple coordinates:\n *\n * **coordinates**\n * - (Required) Array of (longitude, latitude) pairs in the WGS84 spatial reference. Maximum size of 100 coordinates. The order of each pair must be\n * - longitude in the range `-179.99` to `179.99` representing the east/west or x-axis\n * - latitude in the range `-85.05` to `85.05` representing the north/south or y-axis\n * - For example: `[[31.134167, 29.979167], [31.130833, 29.976111], [31.128333, 29.9725]]`\n *\n * **f**\n * - (Optional) Case-sensitive parameter to specify the format in which responses are given. Can either be `json` or `pjson`.\n *\n * **relativeTo**\n * - (Optional) The reference position (datum) from which to measure elevation. The valid values are:\n *\n * - **meanSeaLevel**: The elevation above or below the WGS84 geoid reference surface, which is approximately the mean sea level. It takes into account the local variations in gravity and provides a consistent vertical reference.\n * - **ellipsoid**: Ellipsoidal height is measured with respect to an ellipsoid, which is a mathematical model that approximates the shape of the Earth. It does not consider local variations in gravity and is commonly used in GPS positioning.\n *\n * **token**\n * - (Optional) The authentication token, used to access the elevation service. Alternatively, you can supply a token in the request header with either the `Authorization` or `X-Esri-Authorization` key, using the \"Bearer\" scheme.\n */\n post: operations[\"ElevationAtManyPointsPost\"];\n };\n}\n\nexport interface components {\n schemas: {\n /** @description A geometry point referring to a location on a map. */\n Point: {\n /** @description The spatial reference system the point is relative to. */\n spatialReference: {\n /**\n * @description The Well-Known ID (WKID) value of the spatial reference.\n * @example 4326\n */\n wkid: number;\n };\n /**\n * @description The X coordinate which is measured along the east/west axis.\n * @example 86.925278\n */\n x: number;\n /**\n * @description The Y coordinate which is measured along the north/south axis.\n * @example 27.988333\n */\n y: number;\n /**\n * @description The Z coordinate represents the vertical position of a point above or below a reference level, such as sea level (in meters, rounded to the nearest meter).\n * @example 8744\n */\n z: number;\n };\n /** @description A structure containing human readable metadata about the specified point. */\n ElevationInfo: {\n /**\n * @description The reference position (datum) from which to measure elevation.\n * The valid values are:\n * - meanSeaLevel: The elevation above or below the WGS84 geoid reference surface, which is approximately the mean sea level.\n * It takes into account the local variations in gravity and provides a consistent vertical reference.\n * - ellipsoid: Ellipsoidal height is measured with respect to an ellipsoid, which is a mathematical model that approximates the shape of the Earth.\n * It does not consider local variations in gravity and is commonly used in GPS positioning.\n *\n * @default meanSeaLevel\n * @example meanSeaLevel\n * @enum {string}\n */\n relativeTo: \"meanSeaLevel\" | \"ellipsoid\";\n };\n /** @description A structure containing a point including an elevation value (defined as Z). */\n Elevation: {\n /** @description The point containing the elevation. */\n point: components[\"schemas\"][\"Point\"];\n };\n /**\n * @description A structure containing a collection of points which contain elevation values (defined as Z). When returned from\n * a request to the `/elevation/at-many-points` endpoint, the order of the points will match the order of the\n * points in the request.\n */\n Elevations: {\n points: components[\"schemas\"][\"Point\"][];\n };\n Error: {\n /** @description Error information */\n error: {\n /**\n * @description A code identifying the type of error, either an HTTP error code, `498` (signifying invalid or expired token), or `499` (signifying missing token).\n * @example 400\n * @enum {integer}\n */\n code: 400 | 401 | 403 | 404 | 413 | 415 | 498 | 499 | 500;\n /** @description A message describing the error. */\n message: string;\n /** @description List of details about the error. */\n details?: string[];\n /**\n * @description URL that provides the elevation service information.\n * @example https://elevation-api.arcgis.com/arcgis/rest/info\n */\n restInfoUrl?: string;\n };\n };\n /**\n * @description Optional, case-sensitive parameter to specify the format in which responses are given. Can either be `json` or `pjson`.\n * @enum {string}\n */\n Format: \"json\" | \"pjson\";\n };\n responses: {\n /** Response to a request for the elevation at a specified point. */\n ElevationResponse: {\n content: {\n \"application/json\": {\n elevationInfo: components[\"schemas\"][\"ElevationInfo\"];\n result: components[\"schemas\"][\"Elevation\"];\n };\n };\n };\n /**\n * Response to a request for the elevations at specified points. There will be one response point for each point\n * in the request. The order of these points will match the order of the points in the request.\n */\n MultipleElevationsResponse: {\n content: {\n \"application/json\": {\n elevationInfo: components[\"schemas\"][\"ElevationInfo\"];\n result: components[\"schemas\"][\"Elevations\"];\n };\n };\n };\n /** Authentication Error. The API key or token is missing, invalid or expired. */\n UnauthorizedErrorResponse: {\n content: {\n \"application/json\": components[\"schemas\"][\"Error\"];\n };\n };\n /** An error occurred on the server. */\n ServerErrorResponse: {\n content: {\n \"application/json\": components[\"schemas\"][\"Error\"];\n };\n };\n /** Invalid query parameters / Incorrect portal item type. */\n InvalidQueryErrorResponse: {\n content: {\n \"application/json\": components[\"schemas\"][\"Error\"];\n };\n };\n /** The supplied authentication information is valid but does not have permission to access the service. */\n PermissionMissingErrorResponse: {\n content: {\n \"application/json\": components[\"schemas\"][\"Error\"];\n };\n };\n /** The requested resource cannot be accessed because of incorrect sharing permissions. */\n ResourcePermissionErrorResponse: {\n content: {\n \"application/json\": components[\"schemas\"][\"Error\"];\n };\n };\n /** The request body was larger than limits defined by the service. */\n ContentTooLargeErrorResponse: {\n content: {\n \"application/json\": components[\"schemas\"][\"Error\"];\n };\n };\n /** The request's message content is of a media-type that the service does not support. */\n UnsupportedMediaTypeErrorResponse: {\n content: {\n \"application/json\": components[\"schemas\"][\"Error\"];\n };\n };\n };\n parameters: {\n /** @description Optional, case-sensitive parameter to specify the format in which responses are given. Can either be `json` or `pjson`. */\n FormatParam: components[\"schemas\"][\"Format\"];\n /**\n * @description The authentication token, used to access the elevation service.\n *\n * The `token` parameter can be either an API Key or short-lived token.\n *\n * Alternatively, you can supply a token in the request header with one of\n * the following keys using the \"Bearer\" scheme:\n *\n * - `Authorization: Bearer <YOUR_TOKEN>`\n * - `X-Esri-Authorization: Bearer <YOUR_TOKEN>`\n *\n * The provided `token` must be created from an ArcGIS Location Platform account and have the necessary `premium:user:elevation` privilege to use the elevation service.\n *\n * **Developer guide**: To learn more, go to [Security and authentication](https://developers.arcgis.com/documentation/mapping-apis-and-services/security/).\n */\n TokenParam: string;\n /** @description The longitude of the specified point. */\n LongitudeParam: number;\n /** @description The latitude of the specified point. */\n LatitudeParam: number;\n /**\n * @description The reference position (datum) from which to measure elevation.\n * The valid values are:\n * - meanSeaLevel: The elevation above or below the WGS84 geoid reference surface, which is approximately the mean sea level.\n * It takes into account the local variations in gravity and provides a consistent vertical reference.\n * - ellipsoid: Ellipsoidal height is measured with respect to an ellipsoid, which is a mathematical model that approximates the shape of the Earth.\n * It does not consider local variations in gravity and is commonly used in GPS positioning.\n */\n RelativeToParam: \"meanSeaLevel\" | \"ellipsoid\";\n };\n}\n\nexport interface operations {\n /**\n * Returns the elevation in meters at a given longitude and latitude within the WGS84 coordinate system.\n *\n * By default the elevation is measured with respect to the Earth's mean sea level. It takes into account the local variations in gravity and provides a consistent vertical reference.\n *\n * If the `relativeTo` query parameter is set to `ellipsoid`, the elevation will be measured with respect to the ellipsoid. This is a mathematical model that approximates the shape of the Earth. It does not consider local variations in gravity and is commonly used in GPS positioning.\n *\n * Note: You cannot permanently store elevations. Please see the [Terms of use](https://developers.arcgis.com/documentation/mapping-apis-and-services/deployment/terms-of-use/).\n */\n ElevationAtPointGet: {\n parameters: {\n query: {\n /** The longitude of the specified point. */\n lon: components[\"parameters\"][\"LongitudeParam\"];\n /** The latitude of the specified point. */\n lat: components[\"parameters\"][\"LatitudeParam\"];\n /**\n * The reference position (datum) from which to measure elevation.\n * The valid values are:\n * - meanSeaLevel: The elevation above or below the WGS84 geoid reference surface, which is approximately the mean sea level.\n * It takes into account the local variations in gravity and provides a consistent vertical reference.\n * - ellipsoid: Ellipsoidal height is measured with respect to an ellipsoid, which is a mathematical model that approximates the shape of the Earth.\n * It does not consider local variations in gravity and is commonly used in GPS positioning.\n */\n relativeTo?: components[\"parameters\"][\"RelativeToParam\"];\n /**\n * The authentication token, used to access the elevation service.\n *\n * The `token` parameter can be either an API Key or short-lived token.\n *\n * Alternatively, you can supply a token in the request header with one of\n * the following keys using the \"Bearer\" scheme:\n *\n * - `Authorization: Bearer <YOUR_TOKEN>`\n * - `X-Esri-Authorization: Bearer <YOUR_TOKEN>`\n *\n * The provided `token` must be created from an ArcGIS Location Platform account and have the necessary `premium:user:elevation` privilege to use the elevation service.\n *\n * **Developer guide**: To learn more, go to [Security and authentication](https://developers.arcgis.com/documentation/mapping-apis-and-services/security/).\n */\n token?: components[\"parameters\"][\"TokenParam\"];\n /** Optional, case-sensitive parameter to specify the format in which responses are given. Can either be `json` or `pjson`. */\n f?: components[\"parameters\"][\"FormatParam\"];\n };\n };\n responses: {\n 200: components[\"responses\"][\"ElevationResponse\"];\n 400: components[\"responses\"][\"InvalidQueryErrorResponse\"];\n 401: components[\"responses\"][\"UnauthorizedErrorResponse\"];\n 403: components[\"responses\"][\"ResourcePermissionErrorResponse\"];\n \"5XX\": components[\"responses\"][\"ServerErrorResponse\"];\n };\n };\n /**\n * Returns elevations in meters at given longitudes and latitudes within the WGS84 coordinate system.\n *\n * The order of the points returned by this request will be the same as the order of the points passed in the\n * `coordinates` parameter.\n *\n * If the distance between the furthest West and furthest East coordinate exceeds 50km, the service will return a `400` HTTP response as the distance between these points is too large.\n *\n * If the distance between the furthest North and furthest South coordinate exceeds 50km, the service will return a `400` HTTP response as the distance between these points is too large.\n *\n * If any of the points are otherwise invalid, a `400` HTTP response will be returned.\n *\n * By default the elevation is measured with respect to the Earth's mean sea level. It takes into account the local variations in gravity and provides a consistent vertical reference.\n *\n * If the `relativeTo` parameter in the body is set to `ellipsoid`, the elevation will be measured with respect to the ellipsoid. This is a mathematical model that approximates the shape of the Earth. It does not consider local variations in gravity and is commonly used in GPS positioning.\n *\n * Note: You cannot permanently store elevations. Please see the [Terms of use](https://developers.arcgis.com/documentation/mapping-apis-and-services/deployment/terms-of-use/).\n *\n * The Post Body content type must be either:\n * - JSON with content type of `application/json`, or\n * - form URL encoded key-value pairs with content type `application/x-www-form-urlencoded`.\n *\n * The following parameters are used to fetch elevations for multiple coordinates:\n *\n * **coordinates**\n * - (Required) Array of (longitude, latitude) pairs in the WGS84 spatial reference. Maximum size of 100 coordinates. The order of each pair must be\n * - longitude in the range `-179.99` to `179.99` representing the east/west or x-axis\n * - latitude in the range `-85.05` to `85.05` representing the north/south or y-axis\n * - For example: `[[31.134167, 29.979167], [31.130833, 29.976111], [31.128333, 29.9725]]`\n *\n * **f**\n * - (Optional) Case-sensitive parameter to specify the format in which responses are given. Can either be `json` or `pjson`.\n *\n * **relativeTo**\n * - (Optional) The reference position (datum) from which to measure elevation. The valid values are:\n *\n * - **meanSeaLevel**: The elevation above or below the WGS84 geoid reference surface, which is approximately the mean sea level. It takes into account the local variations in gravity and provides a consistent vertical reference.\n * - **ellipsoid**: Ellipsoidal height is measured with respect to an ellipsoid, which is a mathematical model that approximates the shape of the Earth. It does not consider local variations in gravity and is commonly used in GPS positioning.\n *\n * **token**\n * - (Optional) The authentication token, used to access the elevation service. Alternatively, you can supply a token in the request header with either the `Authorization` or `X-Esri-Authorization` key, using the \"Bearer\" scheme.\n */\n ElevationAtManyPointsPost: {\n responses: {\n 200: components[\"responses\"][\"MultipleElevationsResponse\"];\n 400: components[\"responses\"][\"InvalidQueryErrorResponse\"];\n 401: components[\"responses\"][\"UnauthorizedErrorResponse\"];\n 403: components[\"responses\"][\"ResourcePermissionErrorResponse\"];\n 413: components[\"responses\"][\"ContentTooLargeErrorResponse\"];\n 415: components[\"responses\"][\"UnsupportedMediaTypeErrorResponse\"];\n \"5XX\": components[\"responses\"][\"ServerErrorResponse\"];\n };\n requestBody: {\n content: {\n \"application/json\": {\n /**\n * @description The authentication token, used to access the elevation service.\n *\n * The `token` parameter can be either an API Key or short-lived token.\n *\n * Alternatively, you can supply a token in the request header with one of\n * the following keys using the \"Bearer\" scheme:\n *\n * - `Authorization: Bearer <YOUR_TOKEN>`\n * - `X-Esri-Authorization: Bearer <YOUR_TOKEN>`\n *\n * The provided `token` must be created from an ArcGIS Location Platform account and have the necessary `premium:user:elevation` privilege to use the elevation service.\n *\n * **Developer guide**: To learn more, go to [Security and authentication](https://developers.arcgis.com/documentation/security-and-authentication/).\n *\n * @example My token\n */\n token?: string;\n /**\n * @description The reference position (datum) from which to measure elevation.\n * The valid values are:\n * - meanSeaLevel: The elevation above or below the WGS84 geoid reference surface, which is approximately the mean sea level.\n * It takes into account the local variations in gravity and provides a consistent vertical reference.\n * - ellipsoid: Ellipsoidal height is measured with respect to an ellipsoid, which is a mathematical model that approximates the shape of the Earth.\n * It does not consider local variations in gravity and is commonly used in GPS positioning.\n *\n * @default meanSeaLevel\n * @example meanSeaLevel\n * @enum {string}\n */\n relativeTo?: \"meanSeaLevel\" | \"ellipsoid\";\n f?: components[\"schemas\"][\"Format\"];\n /**\n * @description Array of (longitude, latitude) pairs in the WGS84 spatial reference. Maximum size of 100 coordinates. The order of each pair must be\n * - longitude in the range `-179.99` to `179.99` representing the east/west or x-axis\n * - latitude in the range `-85.05` to `85.05` representing the north/south or y-axis\n *\n * For example: `[[31.134167, 29.979167], [31.130833, 29.976111], [31.128333, 29.9725]]`\n *\n * @example [\n * [\n * 31.134167,\n * 29.979167\n * ],\n * [\n * 31.130833,\n * 29.976111\n * ],\n * [\n * 31.128333,\n * 29.9725\n * ]\n * ]\n */\n coordinates: number[][];\n };\n \"application/x-www-form-urlencoded\": {\n /**\n * @description The authentication token, used to access the elevation service.\n *\n * The `token` parameter can be either an API Key or short-lived token.\n *\n * Alternatively, you can supply a token in the request header with one of\n * the following keys using the \"Bearer\" scheme:\n *\n * - `Authorization: Bearer <YOUR_TOKEN>`\n * - `X-Esri-Authorization: Bearer <YOUR_TOKEN>`\n *\n * The provided `token` must be created from an ArcGIS Location Platform account and have the necessary `premium:user:elevation` privilege to use the elevation service.\n *\n * **Developer guide**: To learn more, go to [Security and authentication](https://developers.arcgis.com/documentation/security-and-authentication/).\n *\n * @example My token\n */\n token?: string;\n /**\n * @description The reference position (datum) from which to measure elevation.\n * The valid values are:\n * - meanSeaLevel: The elevation above or below the WGS84 geoid reference surface, which is approximately the mean sea level.\n * It takes into account the local variations in gravity and provides a consistent vertical reference.\n * - ellipsoid: Ellipsoidal height is measured with respect to an ellipsoid, which is a mathematical model that approximates the shape of the Earth.\n * It does not consider local variations in gravity and is commonly used in GPS positioning.\n *\n * @default meanSeaLevel\n * @example meanSeaLevel\n * @enum {string}\n */\n relativeTo?: \"meanSeaLevel\" | \"ellipsoid\";\n f?: components[\"schemas\"][\"Format\"];\n /**\n * @description Array of (longitude, latitude) pairs in the WGS84 spatial reference. Maximum size of 100 coordinates. The order of each pair must be\n * - longitude in the range `-179.99` to `179.99` representing the east/west or x-axis\n * - latitude in the range `-85.05` to `85.05` representing the north/south or y-axis\n *\n * For example: `[[31.134167, 29.979167], [31.130833, 29.976111], [31.128333, 29.9725]]`\n *\n * @example [\n * [\n * 31.134167,\n * 29.979167\n * ],\n * [\n * 31.130833,\n * 29.976111\n * ],\n * [\n * 31.128333,\n * 29.9725\n * ]\n * ]\n */\n coordinates: number[][];\n };\n };\n };\n };\n}\n\nexport interface external {}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":";;;AAAa,QAAA,OAAO,GAClB,4EAA4E,CAAC","sourcesContent":["export const baseUrl =\n \"https://elevation-api.arcgis.com/arcgis/rest/services/elevation-service/v1\";\n"]}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { IRequestOptions } from "@esri/arcgis-rest-request";
|
|
2
|
+
import { operations } from "./openapi-types.js";
|
|
3
|
+
declare type queryParams = Pick<operations["ElevationAtManyPointsPost"]["requestBody"]["content"]["application/json"], "coordinates" | "relativeTo">;
|
|
4
|
+
declare type successResponse = operations["ElevationAtManyPointsPost"]["responses"]["200"]["content"]["application/json"];
|
|
5
|
+
/**
|
|
6
|
+
* The response format for {@linkcode findElevationAtPoint};
|
|
7
|
+
*/
|
|
8
|
+
export interface IFindElevationAtManyPointsResponse extends successResponse {
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Options for {@linkcode findElevationAtPoint}.
|
|
12
|
+
*/
|
|
13
|
+
export interface IFindElevationAtManyPointsOptions extends Omit<IRequestOptions, "httpMethod" | "f">, queryParams {
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* This method returns elevations in meters at given longitudes and latitudes
|
|
17
|
+
* within the WGS84 coordinate system. The order of the points returned by this
|
|
18
|
+
* request will be the same as the order of the points passed in the coordinates
|
|
19
|
+
* parameter.
|
|
20
|
+
*
|
|
21
|
+
* If the distance between the furthest West and furthest East coordinate or
|
|
22
|
+
* the furthest North and furthest South coordinate exceeds 50km, the service
|
|
23
|
+
* will return a 400 HTTP response as the distance between these points is too
|
|
24
|
+
* large.
|
|
25
|
+
*
|
|
26
|
+
* By default the elevation is measured with respect to the Earth's mean sea level.
|
|
27
|
+
* It takes into account the local variations in gravity and provides a consistent
|
|
28
|
+
* vertical reference.
|
|
29
|
+
*
|
|
30
|
+
* If the relativeTo query parameter is set to `ellipsoid`, the elevation will be
|
|
31
|
+
* measured with respect to the ellipsoid. This is a mathematical model that
|
|
32
|
+
* approximates the shape of the Earth. It does not consider local variations
|
|
33
|
+
* in gravity and is commonly used in GPS positioning.
|
|
34
|
+
*
|
|
35
|
+
* ```
|
|
36
|
+
* import { findElevationAtManyPoints } from "@esri/arcgis-rest-elevation";
|
|
37
|
+
* import { ApiKeyManager } from "@esri/arcgis-rest-request";
|
|
38
|
+
*
|
|
39
|
+
* const results = await findElevationAtManyPoints({
|
|
40
|
+
* coordinates: [[31.134167, 29.979167], [31.130833, 29.976111], [31.128333, 29.9725]],
|
|
41
|
+
* authentication: ApiKeyManager.fromKey("YOUR_ACCESS_TOKEN");
|
|
42
|
+
* });
|
|
43
|
+
*
|
|
44
|
+
* console.log(results)
|
|
45
|
+
* ```
|
|
46
|
+
*/
|
|
47
|
+
export declare function findElevationAtManyPoints(requestOptions: IFindElevationAtManyPointsOptions): Promise<IFindElevationAtManyPointsResponse>;
|
|
48
|
+
export {};
|