usgs-ned
Library for use with the The National Map - Elevation Point Query Service of the USGS (formerly known as NED).
The Elevation Point Query Service returns the elevation in international feet or meters for a specific latitude/longitude (NAD 1983) point from the USGS Elevation Service hosted at the NGTOC. Input parameters: x (longitude), y (latitude), units (Feet, Meters), output (XML, JSON). Latitude and longitude must be specified in decimal degrees with southern latitudes and western longitudes represented as negative values.
Installation
Use a package manager (e.g., NPM or Yarn) to install the package named usgs-ned.
npm install usgs-ned
Use
import { getElevationData, MeasurementUnits, WKId } from "usgs-ned";
// Call the webs service.
const elevationData = await getElevationData({
x: -122.57539940320193,
y: 47.258260494342196,
units: MeasurementUnits.Feet,
wkid: WKId.gps,
includeDate: true,
});
// The expected result should be similar to this.
const expectedResult = {
location: {
x: -122.57539940320193,
y: 47.258260494342196,
spatialReference: {
wkid: 4326,
latestWkid: 4326,
},
},
locationId: 0,
value: 13.34829010234212,
rasterId: 42167,
resolution: 1,
attributes: {
AcquisitionDate: new Date(2020, 2, 1)
},
};