2.1.1 • Published 5 years ago

airspace-calculator v2.1.1

Weekly downloads
7
License
Unlicense
Repository
github
Last release
5 years ago

Airspace Calculator

Build Status

A module that will calculate surface penetration using the USGS NED Point Query Service and an ArcGIS Image service.

Demo

You can see the library in action with this single-page application (SPA) web map. This application is built with the ArcGIS API for JavaScript (the older version, 3.X).

Setup

Image Service

You will need an image service in order to use this library. Instructions for setting up an image service can be found here.

Installing the library via NPM

The airspace calculator is hosted on NPM and can be installed as follows:

$ npm install -S airspace-calculator

Use

Below is an example written in TypeScript which shows how to perform a calculation.

import AirspaceCalculator from "airspace-calculator";

const ac = new AirspaceCalculator("https://example.com/arcgis/rest/services/AirportMapApplication/AirspaceCalculatorSurface/ImageServer");
const x = -122.9033660888309;
const y = 46.972736571798244;
const agl = 100;
try {
    const acResult = await ac.calculate(x, y, agl);
    const [outX, outY] = acResult.xy;
    const msg = `An elevation of ${acResult.agl} will penetrate the surface at ${acResult.surfacePenetration}. Coords: [${outX}, ${outY}]`;
} catch (error) {
    console.error(error);
}

For maintainers

Installing dependencies. After the dependencies are installed, the prepare step will run.

$ npm install

Build

$ npm run prepare

Testing

Unit tests are written using Jasmine. You can run the unit tests with the following command.

$ npm test