Learn how to find elevation values for points along a path in New Zealand's South Island
The 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
An ArcGIS Location Platform account.
Steps
Get the starter app
Select a type of authentication below and follow the steps to create a new application.
Set up authentication
Create developer credentials in your portal for the type of authentication you selected.
Set developer credentials
Use the API key or OAuth developer credentials so your application can access location services.
Make a request
You can copy and paste the code below, following the steps to make a request to the Elevation service.
-
Reference the
arcgis-rest-request
andarcgis-rest-elevation
libraries either through CDN, ES Modules, or Node JS. -
Define the parameters needed for the request. Optionally, you can add the
relative
parameter 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 ArcGIS location services in these tutorials: