Learn how to find elevation values for points along a path in New Zealand's South Island
The ArcGIS Elevation service is a location service that returns elevation values for a single location or multiple locations. Elevation coverage is provided for both topography (land elevations) and bathymetry (water depths) and takes location inputs as longitude and latitude coordinates.
In this tutorial, you call the Elevation service to return elevation values for points along a path. The values will be returned as measures above mean sea level in meters.
Prerequisites
You need an ArcGIS Location Platform account.
ArcGIS Online and ArcGIS Enterprise accounts are not supported.
Steps
Get the starter app
Select a type of authentication and follow the steps to create a new app.
Choose API key authentication if you:
- Want the easiest way to get started.
- Want to build public applications that access ArcGIS Location Services and secure items.
- Have an ArcGIS Location Platform or ArcGIS Online account.
Choose user authentication if you:
- Want to build private applications.
- Require application users to sign in with their own ArcGIS account and access resources their behalf.
- Have an ArcGIS Online account.
To learn more about both types of authentication, go to Authentication.
Set up authentication
Set developer credentials
Use the API key or OAuth developer credentials so your application can access ArcGIS services.
Make a request
You can copy and paste the code below, following the steps to make a request to the ArcGIS Elevation service.
-
Reference the
arcgis-rest-requestandarcgis-rest-elevationlibraries either through CDN, ES Modules, or Node JS. -
Define the parameters needed for the request. Optionally, you can add the
relativeparameter to request elevation in measures of mean sea level or ground level (ellipsoid).To -
Make a request to the Elevation service and handle the results.
arcgisRest.findElevationAtManyPoints({
coordinates: points,
authentication: authentication })
.then((response) => {
console.log("Candidates:", response);
document.getElementById("result").textContent = JSON.stringify(response, null, 2);
});
Run the app
Run the app.
The result should look similar to this.What's next?
Learn how to use additional location services in these tutorials: