airspace-calculator
Advanced tools
Comparing version 2.0.0 to 2.1.0
@@ -19,25 +19,29 @@ import ElevationQueryResponse from "usgs-ned/ElevationQueryResult"; | ||
imageServiceUrl: string; | ||
elevationServiceUrl: string; | ||
elevationServiceUrl: string | undefined; | ||
/** | ||
* @param imageServiceUrl - E.g., http://example.com/arcgis/rest/services/Airport/Airport_Surfaces_40ft_Int/ImageServer | ||
* @param [elevationServiceUrl] - Override the default URL to the USGS National Map Elevation service, in case they move the service in the future. | ||
* Performs calculation | ||
* @param x - X coordinate of a point | ||
* @param y - Y coordinate of a point | ||
* @param agl - Height above ground level (AGL) in feet. | ||
* @param imageServiceUrl - E.g., | ||
* http://example.com/arcgis/rest/services/Airport/Airport_Surfaces_40ft_Int/ImageServer | ||
* @param [elevationServiceUrl] - Override the default URL to the USGS National Map Elevation service, | ||
* in case they move the service in the future. | ||
*/ | ||
constructor(imageServiceUrl: string, elevationServiceUrl?: string); | ||
static calculateSurfacePenetration(x: number, y: number, agl: number, imageServiceUrl: string, elevationServiceUrl?: string): Promise<AirspaceCalculatorResult>; | ||
/** | ||
* Performs calculation | ||
* @param {number} x | ||
* @param {number} y | ||
* @param {number} agl - Height above ground level (AGL) in feet. | ||
* @returns {Promise<AirspaceCalculatorResult>} | ||
* @param imageServiceUrl - E.g., | ||
* http://example.com/arcgis/rest/services/Airport/Airport_Surfaces_40ft_Int/ImageServer | ||
* @param [elevationServiceUrl] - Override the default URL to the USGS National Map Elevation service, | ||
* in case they move the service in the future. | ||
*/ | ||
calculate(x: number, y: number, agl: number): Promise<AirspaceCalculatorResult>; | ||
constructor(imageServiceUrl: string, elevationServiceUrl?: string | undefined); | ||
/** | ||
* Performs calculation | ||
* @param {number} x | ||
* @param {number} y | ||
* @param {number} x - The X coordinate | ||
* @param {number} y - The Y coordinate | ||
* @param {number} agl - Height above ground level (AGL) in feet. | ||
* @param {string} imageServiceUrl - E.g., http://example.com/arcgis/rest/services/Airport/Airport_Surfaces_40ft_Int/ImageServer | ||
* @returns {Promise<AirspaceCalculatorResult>} | ||
*/ | ||
static calculateSurfacePenetration: (x: number, y: number, agl: number, imageServiceUrl: string, elevationServiceUrl?: string | undefined) => Promise<AirspaceCalculatorResult>; | ||
calculate(x: number, y: number, agl: number): Promise<AirspaceCalculatorResult>; | ||
} |
@@ -5,2 +5,37 @@ /** | ||
*/ | ||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
return new (P || (P = Promise))(function (resolve, reject) { | ||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } | ||
step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
}); | ||
}; | ||
var __generator = (this && this.__generator) || function (thisArg, body) { | ||
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; | ||
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; | ||
function verb(n) { return function (v) { return step([n, v]); }; } | ||
function step(op) { | ||
if (f) throw new TypeError("Generator is already executing."); | ||
while (_) try { | ||
if (f = 1, y && (t = y[op[0] & 2 ? "return" : op[0] ? "throw" : "next"]) && !(t = t.call(y, op[1])).done) return t; | ||
if (y = 0, t) op = [0, t.value]; | ||
switch (op[0]) { | ||
case 0: case 1: t = op; break; | ||
case 4: _.label++; return { value: op[1], done: false }; | ||
case 5: _.label++; y = op[1]; op = [0]; continue; | ||
case 7: op = _.ops.pop(); _.trys.pop(); continue; | ||
default: | ||
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } | ||
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } | ||
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } | ||
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } | ||
if (t[2]) _.ops.pop(); | ||
_.trys.pop(); continue; | ||
} | ||
op = body.call(thisArg, _); | ||
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } | ||
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; | ||
} | ||
}; | ||
(function (factory) { | ||
@@ -16,11 +51,7 @@ if (typeof module === "object" && typeof module.exports === "object") { | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var usgs_ned_1 = require("usgs-ned"); | ||
var SurfacePenetrationInfo_1 = require("./SurfacePenetrationInfo"); | ||
/** | ||
* @external ArcGisPoint | ||
* @see {@link http://resources.arcgis.com/en/help/arcgis-rest-api/02r3/02r3000000n1000000.htm#POINT|Point} | ||
*/ | ||
/** | ||
* Converts WGS 84 coordinate pair into ArcGIS format point object. | ||
* @returns {ArcGisPoint} | ||
*/ | ||
@@ -31,5 +62,6 @@ function createEsriGeometry(x, y) { | ||
y: y, | ||
// tslint:disable-next-line:object-literal-sort-keys | ||
spatialReference: { | ||
wkid: 4326 | ||
} | ||
wkid: 4326, | ||
}, | ||
}; | ||
@@ -55,60 +87,49 @@ } | ||
* Executes an identify operation on an image service and returns the numeric value. | ||
* @param x - X coordinate | ||
* @param y - Y coordinate | ||
* @param imageServerUrl - Image server URL | ||
* @returns Returns the elevation value. If the value returned from the service cannot be converted | ||
* to a number, the value itself (a string) will be returned. | ||
*/ | ||
function identify(x, y, imageServerUrl) { | ||
var params = { | ||
geometry: createEsriGeometry(x, y), | ||
returnGeometry: false, | ||
geometryType: "esriGeometryPoint", | ||
f: "json" | ||
}; | ||
// Add the identify operation to the URL if not present. | ||
if (!/\/identify\/?$/.test(imageServerUrl)) { | ||
imageServerUrl = imageServerUrl.replace(/\/?$/, "/identify"); | ||
} | ||
// Add the query string URL. | ||
imageServerUrl = [imageServerUrl, objectToQueryString(params)].join("?"); | ||
return fetch(imageServerUrl).then(function (response) { | ||
return response.json(); | ||
// For JSON structure, see response section here: | ||
// http://resources.arcgis.com/en/help/arcgis-rest-api/index.html#/Identify/02r30000010s000000/ | ||
}).then(function (json) { | ||
var pixelValue = json.value; | ||
var n = Number(pixelValue); | ||
// Return the number, or pixel value if not a number. | ||
return isNaN(n) ? pixelValue : n; | ||
return __awaiter(this, void 0, void 0, function () { | ||
var params, queryResponse, jsonObj, pixelValue, n; | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: | ||
params = { | ||
f: "json", | ||
geometry: createEsriGeometry(x, y), | ||
geometryType: "esriGeometryPoint", | ||
returnGeometry: false, | ||
}; | ||
// Add the identify operation to the URL if not present. | ||
if (!/\/identify\/?$/.test(imageServerUrl)) { | ||
imageServerUrl = imageServerUrl.replace(/\/?$/, "/identify"); | ||
} | ||
// Add the query string URL. | ||
imageServerUrl = [imageServerUrl, objectToQueryString(params)].join("?"); | ||
return [4 /*yield*/, fetch(imageServerUrl)]; | ||
case 1: | ||
queryResponse = _a.sent(); | ||
return [4 /*yield*/, queryResponse.json()]; | ||
case 2: | ||
jsonObj = _a.sent(); | ||
pixelValue = jsonObj.value; | ||
n = Number(pixelValue); | ||
// Return the number, or pixel value if not a number. | ||
return [2 /*return*/, isNaN(n) ? pixelValue : n]; | ||
} | ||
}); | ||
}); | ||
} | ||
/** | ||
* Performs calculation | ||
* @param x - X coordinate of a point | ||
* @param y - Y coordinate of a point | ||
* @param agl - Height above ground level (AGL) in feet. | ||
* @param imageServiceUrl - E.g., http://example.com/arcgis/rest/services/Airport/Airport_Surfaces_40ft_Int/ImageServer | ||
* @param [elevationServiceUrl] - Override the default URL to the USGS National Map Elevation service, in case they move the service in the future. | ||
*/ | ||
var calculateSurfacePenetration = function (x, y, agl, imageServiceUrl, elevationServiceUrl) { | ||
var elevationPromise = usgs_ned_1.default(x, y, "Feet", elevationServiceUrl); | ||
var identifyPromise = identify(x, y, imageServiceUrl); | ||
return new Promise(function (resolve, reject) { | ||
Promise.all([elevationPromise, identifyPromise]).then(function (promises) { | ||
var terrainResponse = promises[0]; | ||
var surfaceElevation = typeof promises[1] === "number" ? promises[1] : null; | ||
var spInfo = new SurfacePenetrationInfo_1.default(agl, surfaceElevation, terrainResponse.elevation); | ||
resolve({ | ||
surfacePenetration: spInfo, | ||
terrainInfo: terrainResponse, | ||
xy: [x, y] | ||
}); | ||
}, function (error) { | ||
reject(error); | ||
}); | ||
}); | ||
}; | ||
/** | ||
* Calculates surface penetrations | ||
*/ | ||
var AirspaceCalculator = (function () { | ||
var AirspaceCalculator = /** @class */ (function () { | ||
/** | ||
* @param imageServiceUrl - E.g., http://example.com/arcgis/rest/services/Airport/Airport_Surfaces_40ft_Int/ImageServer | ||
* @param [elevationServiceUrl] - Override the default URL to the USGS National Map Elevation service, in case they move the service in the future. | ||
* @param imageServiceUrl - E.g., | ||
* http://example.com/arcgis/rest/services/Airport/Airport_Surfaces_40ft_Int/ImageServer | ||
* @param [elevationServiceUrl] - Override the default URL to the USGS National Map Elevation service, | ||
* in case they move the service in the future. | ||
*/ | ||
@@ -124,4 +145,36 @@ function AirspaceCalculator(imageServiceUrl, elevationServiceUrl) { | ||
* Performs calculation | ||
* @param {number} x | ||
* @param {number} y | ||
* @param x - X coordinate of a point | ||
* @param y - Y coordinate of a point | ||
* @param agl - Height above ground level (AGL) in feet. | ||
* @param imageServiceUrl - E.g., | ||
* http://example.com/arcgis/rest/services/Airport/Airport_Surfaces_40ft_Int/ImageServer | ||
* @param [elevationServiceUrl] - Override the default URL to the USGS National Map Elevation service, | ||
* in case they move the service in the future. | ||
*/ | ||
AirspaceCalculator.calculateSurfacePenetration = function (x, y, agl, imageServiceUrl, elevationServiceUrl) { | ||
return __awaiter(this, void 0, void 0, function () { | ||
var elevationPromise, identifyPromise, _a, terrainResponse, surfaceElevation, spInfo, output; | ||
return __generator(this, function (_b) { | ||
switch (_b.label) { | ||
case 0: | ||
elevationPromise = usgs_ned_1.default(x, y, "Feet", elevationServiceUrl); | ||
identifyPromise = identify(x, y, imageServiceUrl); | ||
return [4 /*yield*/, Promise.all([elevationPromise, identifyPromise])]; | ||
case 1: | ||
_a = _b.sent(), terrainResponse = _a[0], surfaceElevation = _a[1]; | ||
spInfo = new SurfacePenetrationInfo_1.default(agl, surfaceElevation, terrainResponse.elevation); | ||
output = { | ||
surfacePenetration: spInfo, | ||
terrainInfo: terrainResponse, | ||
xy: [x, y], | ||
}; | ||
return [2 /*return*/, output]; | ||
} | ||
}); | ||
}); | ||
}; | ||
/** | ||
* Performs calculation | ||
* @param {number} x - The X coordinate | ||
* @param {number} y - The Y coordinate | ||
* @param {number} agl - Height above ground level (AGL) in feet. | ||
@@ -131,19 +184,8 @@ * @returns {Promise<AirspaceCalculatorResult>} | ||
AirspaceCalculator.prototype.calculate = function (x, y, agl) { | ||
return calculateSurfacePenetration(x, y, agl, this.imageServiceUrl, this.elevationServiceUrl); | ||
return AirspaceCalculator.calculateSurfacePenetration(x, y, agl, this.imageServiceUrl, this.elevationServiceUrl); | ||
}; | ||
; | ||
return AirspaceCalculator; | ||
}()); | ||
/** | ||
* Performs calculation | ||
* @param {number} x | ||
* @param {number} y | ||
* @param {number} agl - Height above ground level (AGL) in feet. | ||
* @param {string} imageServiceUrl - E.g., http://example.com/arcgis/rest/services/Airport/Airport_Surfaces_40ft_Int/ImageServer | ||
* @returns {Promise<AirspaceCalculatorResult>} | ||
*/ | ||
AirspaceCalculator.calculateSurfacePenetration = calculateSurfacePenetration; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.default = AirspaceCalculator; | ||
}); | ||
//# sourceMappingURL=AirspaceCalculator.js.map |
@@ -6,22 +6,19 @@ /** | ||
import { Point } from "arcgis-rest-api"; | ||
import getElevation from "usgs-ned"; | ||
import ElevationQueryResponse from "usgs-ned/ElevationQueryResult"; | ||
import { IdentifyResponse } from "./arcgis-rest-api-ext"; | ||
import SurfacePenetrationInfo from "./SurfacePenetrationInfo"; | ||
/** | ||
* @external ArcGisPoint | ||
* @see {@link http://resources.arcgis.com/en/help/arcgis-rest-api/02r3/02r3000000n1000000.htm#POINT|Point} | ||
*/ | ||
/** | ||
* Converts WGS 84 coordinate pair into ArcGIS format point object. | ||
* @returns {ArcGisPoint} | ||
*/ | ||
function createEsriGeometry(x: number, y: number) { | ||
function createEsriGeometry(x: number, y: number): Point { | ||
return { | ||
x: x, | ||
y: y, | ||
x, | ||
y, | ||
// tslint:disable-next-line:object-literal-sort-keys | ||
spatialReference: { | ||
wkid: 4326 | ||
} | ||
wkid: 4326, | ||
}, | ||
}; | ||
@@ -34,4 +31,4 @@ } | ||
function objectToQueryString(o: any) { | ||
let output = []; | ||
for (let name in o) { | ||
const output = []; | ||
for (const name in o) { | ||
if (o.hasOwnProperty(name)) { | ||
@@ -50,9 +47,14 @@ let v = o[name]; | ||
* Executes an identify operation on an image service and returns the numeric value. | ||
* @param x - X coordinate | ||
* @param y - Y coordinate | ||
* @param imageServerUrl - Image server URL | ||
* @returns Returns the elevation value. If the value returned from the service cannot be converted | ||
* to a number, the value itself (a string) will be returned. | ||
*/ | ||
function identify(x: number, y: number, imageServerUrl: string): Promise<number | string> { | ||
let params = { | ||
async function identify(x: number, y: number, imageServerUrl: string): Promise<number | string> { | ||
const params = { | ||
f: "json", | ||
geometry: createEsriGeometry(x, y), | ||
geometryType: "esriGeometryPoint", | ||
returnGeometry: false, | ||
geometryType: "esriGeometryPoint", | ||
f: "json" | ||
}; | ||
@@ -68,12 +70,10 @@ | ||
return fetch(imageServerUrl).then(function (response) { | ||
return response.json(); | ||
// For JSON structure, see response section here: | ||
// http://resources.arcgis.com/en/help/arcgis-rest-api/index.html#/Identify/02r30000010s000000/ | ||
}).then(function (json: any) { | ||
let pixelValue = json.value as string; | ||
let n = Number(pixelValue); | ||
// Return the number, or pixel value if not a number. | ||
return isNaN(n) ? pixelValue : n; | ||
}); | ||
const queryResponse = await fetch(imageServerUrl); | ||
// For JSON structure, see response section here: | ||
// http://resources.arcgis.com/en/help/arcgis-rest-api/index.html#/Identify/02r30000010s000000/ | ||
const jsonObj: IdentifyResponse = await queryResponse.json(); | ||
const pixelValue = jsonObj.value; | ||
const n = Number(pixelValue); | ||
// Return the number, or pixel value if not a number. | ||
return isNaN(n) ? pixelValue : n; | ||
} | ||
@@ -94,31 +94,2 @@ | ||
/** | ||
* Performs calculation | ||
* @param x - X coordinate of a point | ||
* @param y - Y coordinate of a point | ||
* @param agl - Height above ground level (AGL) in feet. | ||
* @param imageServiceUrl - E.g., http://example.com/arcgis/rest/services/Airport/Airport_Surfaces_40ft_Int/ImageServer | ||
* @param [elevationServiceUrl] - Override the default URL to the USGS National Map Elevation service, in case they move the service in the future. | ||
*/ | ||
let calculateSurfacePenetration = function (x: number, y: number, agl: number, imageServiceUrl: string, elevationServiceUrl?: string): Promise<AirspaceCalculatorResult> { | ||
let elevationPromise = getElevation(x, y, "Feet", elevationServiceUrl); | ||
let identifyPromise = identify(x, y, imageServiceUrl); | ||
return new Promise(function (resolve, reject) { | ||
Promise.all([elevationPromise, identifyPromise]).then(function (promises) { | ||
let terrainResponse = promises[0]; | ||
let surfaceElevation = typeof promises[1] === "number" ? promises[1] : null; | ||
let spInfo = new SurfacePenetrationInfo(agl, surfaceElevation, terrainResponse.elevation); | ||
resolve({ | ||
surfacePenetration: spInfo, | ||
terrainInfo: terrainResponse, | ||
xy: [x, y] | ||
}); | ||
}, function (error) { | ||
reject(error); | ||
}); | ||
}); | ||
}; | ||
/** | ||
* Calculates surface penetrations | ||
@@ -128,5 +99,32 @@ */ | ||
/** | ||
* @param imageServiceUrl - E.g., http://example.com/arcgis/rest/services/Airport/Airport_Surfaces_40ft_Int/ImageServer | ||
* @param [elevationServiceUrl] - Override the default URL to the USGS National Map Elevation service, in case they move the service in the future. | ||
* Performs calculation | ||
* @param x - X coordinate of a point | ||
* @param y - Y coordinate of a point | ||
* @param agl - Height above ground level (AGL) in feet. | ||
* @param imageServiceUrl - E.g., | ||
* http://example.com/arcgis/rest/services/Airport/Airport_Surfaces_40ft_Int/ImageServer | ||
* @param [elevationServiceUrl] - Override the default URL to the USGS National Map Elevation service, | ||
* in case they move the service in the future. | ||
*/ | ||
public static async calculateSurfacePenetration( | ||
x: number, y: number, agl: number, imageServiceUrl: string, elevationServiceUrl?: string) { | ||
const elevationPromise = getElevation(x, y, "Feet", elevationServiceUrl); | ||
const identifyPromise = identify(x, y, imageServiceUrl); | ||
const [terrainResponse, surfaceElevation] = await Promise.all([elevationPromise, identifyPromise]); | ||
const spInfo = new SurfacePenetrationInfo(agl, surfaceElevation, terrainResponse.elevation); | ||
const output: AirspaceCalculatorResult = { | ||
surfacePenetration: spInfo, | ||
terrainInfo: terrainResponse, | ||
xy: [x, y], | ||
}; | ||
return output; | ||
} | ||
/** | ||
* @param imageServiceUrl - E.g., | ||
* http://example.com/arcgis/rest/services/Airport/Airport_Surfaces_40ft_Int/ImageServer | ||
* @param [elevationServiceUrl] - Override the default URL to the USGS National Map Elevation service, | ||
* in case they move the service in the future. | ||
*/ | ||
constructor(public imageServiceUrl: string, public elevationServiceUrl?: string) { | ||
@@ -140,20 +138,12 @@ if (!imageServiceUrl) { | ||
* Performs calculation | ||
* @param {number} x | ||
* @param {number} y | ||
* @param {number} x - The X coordinate | ||
* @param {number} y - The Y coordinate | ||
* @param {number} agl - Height above ground level (AGL) in feet. | ||
* @returns {Promise<AirspaceCalculatorResult>} | ||
*/ | ||
calculate(x: number, y: number, agl: number) { | ||
return calculateSurfacePenetration(x, y, agl, this.imageServiceUrl, this.elevationServiceUrl); | ||
}; | ||
public calculate(x: number, y: number, agl: number) { | ||
return AirspaceCalculator.calculateSurfacePenetration( | ||
x, y, agl, this.imageServiceUrl, this.elevationServiceUrl); | ||
} | ||
/** | ||
* Performs calculation | ||
* @param {number} x | ||
* @param {number} y | ||
* @param {number} agl - Height above ground level (AGL) in feet. | ||
* @param {string} imageServiceUrl - E.g., http://example.com/arcgis/rest/services/Airport/Airport_Surfaces_40ft_Int/ImageServer | ||
* @returns {Promise<AirspaceCalculatorResult>} | ||
*/ | ||
static calculateSurfacePenetration = calculateSurfacePenetration; | ||
} | ||
} |
@@ -1,6 +0,11 @@ | ||
var __extends = (this && this.__extends) || function (d, b) { | ||
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; | ||
function __() { this.constructor = d; } | ||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); | ||
}; | ||
var __extends = (this && this.__extends) || (function () { | ||
var extendStatics = Object.setPrototypeOf || | ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || | ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; | ||
return function (d, b) { | ||
extendStatics(d, b); | ||
function __() { this.constructor = d; } | ||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); | ||
}; | ||
})(); | ||
(function (factory) { | ||
@@ -12,6 +17,7 @@ if (typeof module === "object" && typeof module.exports === "object") { | ||
else if (typeof define === "function" && define.amd) { | ||
define(["require", "exports", "./UI", "esri/Color", "esri/toolbars/draw", "esri/layers/GraphicsLayer", "esri/graphic", "esri/geometry/Point", "esri/renderers/UniqueValueRenderer", "esri/symbols/SimpleMarkerSymbol", "esri/symbols/SimpleLineSymbol", "esri/InfoTemplate"], factory); | ||
define(["require", "exports", "esri/Color", "esri/geometry/Point", "esri/graphic", "esri/InfoTemplate", "esri/layers/GraphicsLayer", "esri/renderers/UniqueValueRenderer", "esri/symbols/SimpleLineSymbol", "esri/symbols/SimpleMarkerSymbol", "esri/toolbars/draw", "./UI"], factory); | ||
} | ||
})(function (require, exports) { | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
/** | ||
@@ -21,12 +27,12 @@ * Airspace Calculator for use with ArcGIS API for JavaScript. | ||
*/ | ||
var UI_1 = require("./UI"); | ||
var Color = require("esri/Color"); | ||
var Draw = require("esri/toolbars/draw"); | ||
var Point = require("esri/geometry/Point"); | ||
var Graphic = require("esri/graphic"); | ||
var InfoTemplate = require("esri/InfoTemplate"); | ||
var GraphicsLayer = require("esri/layers/GraphicsLayer"); | ||
var Graphic = require("esri/graphic"); | ||
var Point = require("esri/geometry/Point"); | ||
var UniqueValueRenderer = require("esri/renderers/UniqueValueRenderer"); | ||
var SimpleLineSymbol = require("esri/symbols/SimpleLineSymbol"); | ||
var SimpleMarkerSymbol = require("esri/symbols/SimpleMarkerSymbol"); | ||
var SimpleLineSymbol = require("esri/symbols/SimpleLineSymbol"); | ||
var InfoTemplate = require("esri/InfoTemplate"); | ||
var Draw = require("esri/toolbars/draw"); | ||
var UI_1 = require("./UI"); | ||
/** | ||
@@ -45,3 +51,3 @@ * Creates the renderer | ||
label: "Penetration", | ||
description: "Penetration" | ||
description: "Penetration", | ||
}); | ||
@@ -94,3 +100,3 @@ return renderer; | ||
y: acResult.xy[1], | ||
spatialReference: { wkid: 4326 } | ||
spatialReference: { wkid: 4326 }, | ||
}); | ||
@@ -103,3 +109,3 @@ var graphic = new Graphic(point, undefined, { | ||
terrainElevation: acResult.surfacePenetration.terrainElevation, | ||
penetratesSurface: acResult.surfacePenetration.penetratesSurface ? 1 : 0 | ||
penetratesSurface: acResult.surfacePenetration.penetratesSurface ? 1 : 0, | ||
}); | ||
@@ -122,5 +128,5 @@ return graphic; | ||
function formatResults(graphic) { | ||
var output, message, list; | ||
message = ["A structure ", graphic.attributes.agl, "' above ground level ", graphic.attributes.penetratesSurface ? " would " : " would not ", " penetrate an airport's airspace."].join(""); | ||
output = document.createElement("div"); | ||
// tslint:disable-next-line:max-line-length | ||
var message = "A structure " + graphic.attributes.agl + "' above ground level " + (graphic.attributes.penetratesSurface ? " would " : " would not ") + " penetrate an airport's airspace."; | ||
var output = document.createElement("div"); | ||
var p = document.createElement("p"); | ||
@@ -139,10 +145,11 @@ var a; | ||
} | ||
list = document.createElement("dl"); | ||
var list = document.createElement("dl"); | ||
output.appendChild(list); | ||
var data = { | ||
"Penetration of <abbr title='Federal Aviation Regulations'>FAR</abbr> Surface occurred at": formatFeetAsFeetAndInchesAndMeters(graphic.attributes.distanceFromSurface), | ||
"Terrain Elevation": formatFeetAsFeetAndInchesAndMeters(graphic.attributes.terrainElevation) | ||
"Terrain Elevation": formatFeetAsFeetAndInchesAndMeters(graphic.attributes.terrainElevation), | ||
}; | ||
if (graphic.attributes.penetratesSurface) { | ||
data["Structure Exceeds <abbr title='Federal Aviation Regulations'>FAR</abbr> Surface by"] = formatFeetAsFeetAndInchesAndMeters(graphic.attributes.penetrationOfSurface); | ||
data["Structure Exceeds <abbr title='Federal Aviation Regulations'>FAR</abbr> Surface by"] = | ||
formatFeetAsFeetAndInchesAndMeters(graphic.attributes.penetrationOfSurface); | ||
} | ||
@@ -166,7 +173,9 @@ for (var propName in data) { | ||
*/ | ||
var ArcGisUI = (function (_super) { | ||
var ArcGisUI = /** @class */ (function (_super) { | ||
__extends(ArcGisUI, _super); | ||
// tslint:enable:variable-name | ||
function ArcGisUI(imageServiceUrl, elevationServiceUrl) { | ||
var _this = _super.call(this, imageServiceUrl, elevationServiceUrl) || this; | ||
_this.zoomLevel = 11; | ||
// tslint:disable:variable-name | ||
_this._draw = null; | ||
@@ -183,4 +192,4 @@ _this._map = null; | ||
spatialReference: { | ||
wkid: 4326 | ||
} | ||
wkid: 4326, | ||
}, | ||
}); | ||
@@ -222,3 +231,3 @@ if (!this._markerGraphic) { | ||
var evt = new CustomEvent("draw-complete", { | ||
detail: drawResponse | ||
detail: drawResponse, | ||
}); | ||
@@ -230,3 +239,3 @@ self.form.dispatchEvent(evt); | ||
}); | ||
this.form.addEventListener("calculation-complete", function (e) { | ||
this.form.addEventListener("calculation-complete", (function (e) { | ||
var acResult = e.detail; | ||
@@ -236,10 +245,10 @@ var graphic = acResultToGraphic(acResult); | ||
self.updateMapMarker(); | ||
}); | ||
})); | ||
this.form.addEventListener("clear-graphics", function () { | ||
self._resultLayer.clear(); | ||
}); | ||
this.form.addEventListener("coordinates-update", function (e) { | ||
this.form.addEventListener("coordinates-update", (function (e) { | ||
var dmsCoordinates = e ? e.detail : null; | ||
self.updateMapMarker(dmsCoordinates); | ||
}); | ||
})); | ||
var renderer = createRenderer(); | ||
@@ -249,3 +258,3 @@ var infoTemplate = new InfoTemplate(formatTitle, formatResults); | ||
id: "results", | ||
infoTemplate: infoTemplate | ||
infoTemplate: infoTemplate, | ||
}); | ||
@@ -273,5 +282,4 @@ this._resultLayer.setRenderer(renderer); | ||
}(UI_1.default)); | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.default = ArcGisUI; | ||
}); | ||
//# sourceMappingURL=ArcGisUI.js.map |
{ | ||
"name": "airspace-calculator", | ||
"version": "2.0.0", | ||
"version": "2.1.0", | ||
"description": "Module that uses ArcGIS image service and USGS elevation service to determine if a structure can be erected at a given height. Also provides UI controls.", | ||
"main": "AirspaceCalculator.js", | ||
"scripts": { | ||
"minifycss": "cssnano AirspaceCalculator.css AirspaceCalculator.min.css", | ||
"prepublish": "tsc && npm run minifycss", | ||
"prepare": "tsc", | ||
"test": "jasmine" | ||
@@ -14,3 +13,2 @@ }, | ||
"AirspaceCalculator.d.ts", | ||
"AirspaceCalculator.d.ts", | ||
"AirspaceCalculator.js.map", | ||
@@ -22,3 +20,2 @@ "AirspaceCalculator.ts", | ||
"SurfacePenetrationInfo.d.ts", | ||
"SurfacePenetrationInfo.d.ts", | ||
"SurfacePenetrationInfo.js", | ||
@@ -28,3 +25,2 @@ "SurfacePenetrationInfo.js.map", | ||
"UI.d.ts", | ||
"UI.d.ts", | ||
"UI.js", | ||
@@ -51,11 +47,11 @@ "UI.js.map", | ||
"devDependencies": { | ||
"@types/arcgis-js-api": "^3.19.0 <4", | ||
"@types/geojson": "0.0.31", | ||
"@types/jasmine": "^2.5.40", | ||
"@types/whatwg-fetch": "0.0.33", | ||
"jasmine": "^2.5.3", | ||
"tslint": "^4.3.1", | ||
"typescript": "^2.1.5" | ||
"@types/arcgis-js-api": "^3.20.0 <4", | ||
"@types/geojson": "^7946.0.0", | ||
"@types/jasmine": "^2.8.3", | ||
"jasmine": "^2.8.0", | ||
"tslint": "^5.9.1", | ||
"typescript": "^2.6.2" | ||
}, | ||
"dependencies": { | ||
"@types/arcgis-rest-api": "^10.4.3", | ||
"dms-conversion": "^3.0.0", | ||
@@ -62,0 +58,0 @@ "usgs-ned": "~3.0.2" |
@@ -9,11 +9,67 @@ Airspace Calculator | ||
[Demo](http://wsdot-gis.github.io/airspace-calculator/demo/) | ||
Demo | ||
---- | ||
## Setup ## | ||
[You can see the library in action with this single-page application (SPA) web map.](http://wsdot-gis.github.io/airspace-calculator/demo/) This application is built with the [ArcGIS API for JavaScript] (the older version, [3.X](https://developers.arcgis.com/javascript/3/)). | ||
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](http://enterprise.arcgis.com/en/server/latest/publish-services/windows/key-concepts-for-image-services.htm). | ||
### Installing the library via NPM ### | ||
The airspace calculator is hosted on NPM and can be installed as follows: | ||
```console | ||
$ npm install -S airspace-calculator | ||
``` | ||
$ bower install | ||
Use | ||
--- | ||
Below is an example written in TypeScript which shows how to perform a calculation. | ||
```TypeScript | ||
const ac = new AirspaceCalculator("http://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); | ||
} | ||
``` | ||
[USGS NED Point Query Service]:http://ned.usgs.gov/epqs/ | ||
[Image Service]:http://resources.arcgis.com/en/help/arcgis-rest-api/#/Image_Service/02r3000000q8000000/ | ||
For maintainers | ||
--------------- | ||
Installing dependencies. After the dependencies are installed, the *prepare* step will run. | ||
```console | ||
$ npm install | ||
``` | ||
Build | ||
```console | ||
$ npm run prepare | ||
``` | ||
### Testing ### | ||
Unit tests are written using [Jasmine]. You can run the unit tests with the following command. | ||
```console | ||
$ npm test | ||
``` | ||
[ArcGIS API for JavaScript]:https://developers.arcgis.com/javascript/ | ||
[Image Service]:https://resources.arcgis.com/en/help/arcgis-rest-api/#/Image_Service/02r3000000q8000000/ | ||
[Jasmine]:https://jasmine.github.io/ | ||
[NPM]:https://www.npmjs.com/ | ||
[USGS NED Point Query Service]:https://ned.usgs.gov/epqs/ |
@@ -14,6 +14,8 @@ /** | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
/** | ||
* Provides information about surface penetration. | ||
*/ | ||
var SurfacePenetrationInfo = (function () { | ||
var SurfacePenetrationInfo = /** @class */ (function () { | ||
// tslint:enable:variable-name | ||
/** | ||
@@ -88,3 +90,3 @@ * Creates a new instance of this class | ||
get: function () { | ||
return this.surfaceElevation != null ? this.agl - this.distanceFromSurface : null; | ||
return this.surfaceElevation != null ? this.agl - (this.distanceFromSurface || 0) : null; | ||
}, | ||
@@ -106,5 +108,4 @@ enumerable: true, | ||
}()); | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.default = SurfacePenetrationInfo; | ||
}); | ||
//# sourceMappingURL=SurfacePenetrationInfo.js.map |
@@ -9,5 +9,7 @@ /** | ||
export default class SurfacePenetrationInfo { | ||
// tslint:disable:variable-name | ||
private _agl: number; | ||
private _surfaceElevation: number | null; | ||
private _terrainElevation: number; | ||
// tslint:enable:variable-name | ||
@@ -68,3 +70,3 @@ /** | ||
public get penetrationOfSurface(): number | null { | ||
return this.surfaceElevation != null ? this.agl - this.distanceFromSurface : null; | ||
return this.surfaceElevation != null ? this.agl - (this.distanceFromSurface || 0) : null; | ||
} | ||
@@ -79,2 +81,2 @@ | ||
} | ||
} |
@@ -24,4 +24,4 @@ import AirspaceCalculator from "./AirspaceCalculator"; | ||
export default class UI { | ||
_airspaceCalc: AirspaceCalculator; | ||
_form: AirspaceCalculatorForm; | ||
private _airspaceCalc; | ||
private _form; | ||
readonly airspaceCalculator: AirspaceCalculator; | ||
@@ -28,0 +28,0 @@ readonly form: AirspaceCalculatorForm; |
43
UI.js
@@ -12,2 +12,3 @@ /*global define, require, module*/ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
/** | ||
@@ -76,7 +77,8 @@ * Provides Airspace Calculator UI | ||
input.required = Boolean(options.required); | ||
var ignoredOptionNames = /^(?:(?:label)|(required))$/i, propVal; | ||
var ignoredOptionNames = /^(?:(?:label)|(required))$/i; | ||
// tslint:disable-next-line:forin | ||
for (var name_1 in options) { | ||
var option = options[name_1]; | ||
if (options.hasOwnProperty(name_1) && !ignoredOptionNames.test(option) && option != null) { | ||
propVal = option; | ||
var propVal = option; | ||
if (propVal instanceof RegExp) { | ||
@@ -99,3 +101,3 @@ input.setAttribute(name_1, propVal.source); | ||
*/ | ||
var UI = (function () { | ||
var UI = /** @class */ (function () { | ||
function UI(imageServiceUrl, elevationServiceUrl) { | ||
@@ -105,6 +107,6 @@ this._airspaceCalc = new AirspaceCalculator_1.default(imageServiceUrl, elevationServiceUrl); | ||
var coordinateBlur = function () { | ||
var form = this.form; | ||
var theForm = self.form; | ||
// Parse to coordinates. | ||
var x = dms_conversion_1.parseDms(form.x.value); | ||
var y = dms_conversion_1.parseDms(form.y.value); | ||
var x = dms_conversion_1.parseDms(theForm.x.value); | ||
var y = dms_conversion_1.parseDms(theForm.y.value); | ||
var dms; | ||
@@ -120,5 +122,5 @@ // Create a DmsCoordinates object to ensure values are valid. | ||
var evt = new CustomEvent("coordinates-update", { | ||
detail: dms | ||
detail: dms, | ||
}); | ||
form.dispatchEvent(evt); | ||
theForm.dispatchEvent(evt); | ||
}; | ||
@@ -139,3 +141,3 @@ var form = document.createElement("form"); | ||
required: "required", | ||
autocomplete: "on" | ||
autocomplete: "on", | ||
}); | ||
@@ -154,3 +156,3 @@ var div = document.createElement("div"); | ||
required: "required", | ||
autocomplete: "on" | ||
autocomplete: "on", | ||
}); | ||
@@ -168,3 +170,3 @@ div = document.createElement("div"); | ||
min: 1, | ||
required: "required" | ||
required: "required", | ||
}); | ||
@@ -180,3 +182,3 @@ div = document.createElement("div"); | ||
title: "Pick coordinates by clicking a location on the map", | ||
iconClass: ["fa", "fa-location-arrow"] | ||
iconClass: ["fa", "fa-location-arrow"], | ||
}); | ||
@@ -186,3 +188,3 @@ mapButtons.appendChild(btn); | ||
var evt = new CustomEvent("add-from-map", { | ||
detail: null | ||
detail: null, | ||
}); | ||
@@ -194,3 +196,3 @@ form.dispatchEvent(evt); | ||
title: "Clears graphics from the map created by this control", | ||
iconClass: ["fa", "fa-trash"] | ||
iconClass: ["fa", "fa-trash"], | ||
}); | ||
@@ -200,3 +202,3 @@ mapButtons.appendChild(btn); | ||
var evt = new CustomEvent("clear-graphics", { | ||
detail: null | ||
detail: null, | ||
}); | ||
@@ -212,3 +214,3 @@ form.dispatchEvent(evt); | ||
caption: "Calculate", | ||
title: "Begin the calculation" | ||
title: "Begin the calculation", | ||
}); | ||
@@ -219,3 +221,3 @@ div.appendChild(btn); | ||
caption: "Reset", | ||
title: "Resets the form" | ||
title: "Resets the form", | ||
}); | ||
@@ -242,3 +244,3 @@ div.appendChild(btn); | ||
var evt = new CustomEvent("calculation-complete", { | ||
detail: response | ||
detail: response, | ||
}); | ||
@@ -248,3 +250,3 @@ form.dispatchEvent(evt); | ||
var evt = new CustomEvent("calculation-error", { | ||
detail: error | ||
detail: error, | ||
}); | ||
@@ -258,3 +260,3 @@ form.dispatchEvent(evt); | ||
var evt = new CustomEvent("coordinates-update", { | ||
detail: null | ||
detail: null, | ||
}); | ||
@@ -280,5 +282,4 @@ form.dispatchEvent(evt); | ||
}()); | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.default = UI; | ||
}); | ||
//# sourceMappingURL=UI.js.map |
126
UI.ts
@@ -8,7 +8,5 @@ /*global define, require, module*/ | ||
import { parseDms, default as DmsCoordinates } from "dms-conversion"; | ||
import { default as DmsCoordinates, parseDms } from "dms-conversion"; | ||
import AirspaceCalculator from "./AirspaceCalculator"; | ||
/** | ||
@@ -60,3 +58,3 @@ * @external CustomEvent | ||
type CreateButtonOptions = { | ||
interface CreateButtonOptions { | ||
/** button caption */ | ||
@@ -70,3 +68,3 @@ caption: string | HTMLElement; | ||
type?: string; | ||
}; | ||
} | ||
@@ -87,3 +85,3 @@ // Just return a value to define the module export. | ||
options = options || {}; | ||
let button = document.createElement("button"); | ||
const button = document.createElement("button"); | ||
button.type = options.type || "button"; | ||
@@ -94,4 +92,3 @@ if (options.title) { | ||
let iconSpan = document.createElement("span"); | ||
const iconSpan = document.createElement("span"); | ||
iconSpan.classList.add("icon"); | ||
@@ -101,3 +98,3 @@ if (typeof options.iconClass === "string") { | ||
} else if (Array.isArray(options.iconClass)) { | ||
options.iconClass.forEach(function (s) { | ||
options.iconClass.forEach((s) => { | ||
iconSpan.classList.add(s); | ||
@@ -107,4 +104,3 @@ }); | ||
let captionSpan = document.createElement("span"); | ||
const captionSpan = document.createElement("span"); | ||
captionSpan.classList.add("caption"); | ||
@@ -120,3 +116,2 @@ if (typeof options.caption === "string") { | ||
return button; | ||
@@ -140,11 +135,10 @@ } | ||
autocomplete?: "on" | "off", | ||
min?: number | ||
min?: number, | ||
}) { | ||
options = options || {}; | ||
let docFrag = document.createDocumentFragment(); | ||
const docFrag = document.createDocumentFragment(); | ||
if (options.label) { | ||
let label = document.createElement("label"); | ||
const label = document.createElement("label"); | ||
label.textContent = options.label; | ||
@@ -154,11 +148,12 @@ docFrag.appendChild(label); | ||
let input = document.createElement("input"); | ||
const input = document.createElement("input"); | ||
input.required = Boolean(options.required); | ||
let ignoredOptionNames = /^(?:(?:label)|(required))$/i, propVal; | ||
for (let name in options) { | ||
let option = (options as any)[name]; | ||
const ignoredOptionNames = /^(?:(?:label)|(required))$/i; | ||
// tslint:disable-next-line:forin | ||
for (const name in options) { | ||
const option = (options as any)[name]; | ||
if (options.hasOwnProperty(name) && !ignoredOptionNames.test(option) && option != null) { | ||
propVal = option; | ||
const propVal = option; | ||
if (propVal instanceof RegExp) { | ||
@@ -174,7 +169,5 @@ input.setAttribute(name, propVal.source); | ||
return docFrag; | ||
} | ||
/** | ||
@@ -187,4 +180,6 @@ * UI for the AirspaceCalculator | ||
export default class UI { | ||
_airspaceCalc: AirspaceCalculator; | ||
_form: AirspaceCalculatorForm; | ||
// tslint:disable-next-line:variable-name | ||
private _airspaceCalc: AirspaceCalculator; | ||
// tslint:disable-next-line:variable-name | ||
private _form: AirspaceCalculatorForm; | ||
@@ -203,8 +198,8 @@ public get airspaceCalculator() { | ||
let coordinateBlur = function () { | ||
let form = this.form; | ||
const coordinateBlur = () => { | ||
const theForm = self.form; | ||
// Parse to coordinates. | ||
let x = parseDms(form.x.value); | ||
let y = parseDms(form.y.value); | ||
const x = parseDms(theForm.x.value); | ||
const y = parseDms(theForm.y.value); | ||
@@ -220,15 +215,14 @@ let dms: DmsCoordinates | null; | ||
let evt = new CustomEvent("coordinates-update", { | ||
detail: dms | ||
const evt = new CustomEvent("coordinates-update", { | ||
detail: dms, | ||
}); | ||
form.dispatchEvent(evt); | ||
theForm.dispatchEvent(evt); | ||
}; | ||
let form = document.createElement("form") as AirspaceCalculatorForm; | ||
const form = document.createElement("form") as AirspaceCalculatorForm; | ||
this._form = form; | ||
form.classList.add("airspace-calculator"); | ||
let inputContainer = document.createElement("div"); | ||
const inputContainer = document.createElement("div"); | ||
inputContainer.classList.add("container"); | ||
@@ -246,3 +240,3 @@ | ||
required: "required", | ||
autocomplete: "on" | ||
autocomplete: "on", | ||
}); | ||
@@ -254,3 +248,2 @@ let div = document.createElement("div"); | ||
// Add longitude controls. | ||
@@ -266,3 +259,3 @@ | ||
required: "required", | ||
autocomplete: "on" | ||
autocomplete: "on", | ||
}); | ||
@@ -283,3 +276,3 @@ div = document.createElement("div"); | ||
min: 1, | ||
required: "required" | ||
required: "required", | ||
}); | ||
@@ -293,5 +286,3 @@ div = document.createElement("div"); | ||
let mapButtons = document.createElement("div"); | ||
const mapButtons = document.createElement("div"); | ||
mapButtons.classList.add("map-buttons"); | ||
@@ -302,10 +293,9 @@ | ||
title: "Pick coordinates by clicking a location on the map", | ||
iconClass: ["fa", "fa-location-arrow"] | ||
iconClass: ["fa", "fa-location-arrow"], | ||
}); | ||
mapButtons.appendChild(btn); | ||
btn.addEventListener("click", function () { | ||
let evt = new CustomEvent("add-from-map", { | ||
detail: null | ||
btn.addEventListener("click", () => { | ||
const evt = new CustomEvent("add-from-map", { | ||
detail: null, | ||
}); | ||
@@ -315,13 +305,12 @@ form.dispatchEvent(evt); | ||
btn = createButton({ | ||
caption: "Clear Graphics", | ||
title: "Clears graphics from the map created by this control", | ||
iconClass: ["fa", "fa-trash"] | ||
iconClass: ["fa", "fa-trash"], | ||
}); | ||
mapButtons.appendChild(btn); | ||
btn.addEventListener("click", function () { | ||
let evt = new CustomEvent("clear-graphics", { | ||
detail: null | ||
btn.addEventListener("click", () => { | ||
const evt = new CustomEvent("clear-graphics", { | ||
detail: null, | ||
}); | ||
@@ -340,3 +329,3 @@ form.dispatchEvent(evt); | ||
caption: "Calculate", | ||
title: "Begin the calculation" | ||
title: "Begin the calculation", | ||
}); | ||
@@ -349,9 +338,7 @@ | ||
caption: "Reset", | ||
title: "Resets the form" | ||
title: "Resets the form", | ||
}); | ||
div.appendChild(btn); | ||
form.appendChild(div); | ||
@@ -362,7 +349,6 @@ | ||
// Disable default form submission behavior (which is to navigate away from current page) | ||
form.onsubmit = function () { | ||
let x = parseDms(form.x.value); | ||
let y = parseDms(form.y.value); | ||
form.onsubmit = () => { | ||
const x = parseDms(form.x.value); | ||
const y = parseDms(form.y.value); | ||
let dms: DmsCoordinates | null; | ||
@@ -377,12 +363,12 @@ try { | ||
if (dms) { | ||
let agl = Number(form.height.value); | ||
const agl = Number(form.height.value); | ||
self._airspaceCalc.calculate(x, y, agl).then(function (response) { | ||
let evt = new CustomEvent("calculation-complete", { | ||
detail: response | ||
self._airspaceCalc.calculate(x, y, agl).then((response) => { | ||
const evt = new CustomEvent("calculation-complete", { | ||
detail: response, | ||
}); | ||
form.dispatchEvent(evt); | ||
}, function (error) { | ||
let evt = new CustomEvent("calculation-error", { | ||
detail: error | ||
}, (error) => { | ||
const evt = new CustomEvent("calculation-error", { | ||
detail: error, | ||
}); | ||
@@ -395,5 +381,5 @@ form.dispatchEvent(evt); | ||
form.addEventListener("reset", function () { | ||
let evt = new CustomEvent("coordinates-update", { | ||
detail: null | ||
form.addEventListener("reset", () => { | ||
const evt = new CustomEvent("coordinates-update", { | ||
detail: null, | ||
}); | ||
@@ -400,0 +386,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
79134
6
1531
75
3
+ Added@types/arcgis-rest-api@10.4.8(transitive)