2.8.1 • Published 7 years ago

js-airspace-db-client v2.8.1

Weekly downloads
-
License
UNLICENCED
Repository
-
Last release
7 years ago

js-airspace-db-client

Description

Javascript client for the v2 airspace database.

Installation

http://pkg.airmap.com:7777/package/js-airspace-db-client/latest

Usage

Create a client:

    let client = new Client({
        database_uri: 'postgres://localhost:5432/airspace'
    }

The database connection pool is all set up. You can just start using the various query functions available.

API Specification

constructor

Create a new airspace data client.

Parameters

  • config Object client configuration settings
    • config.database_uri string database connection URI

Returns Client

airspace

Airspace functions

status

Status functions Instance of AirspaceClient

rules

Functions pertaining to rules and regulations from the Airspace Database.

airspace_advisory

Function to retrieve advisories from the airspace db

AirspaceClient

Extends BaseClient

This is a class for a specific database queries.

findByGroupId

Search the airspace table for the geometry that has the specified group_geo_uuid.

Parameters

  • uuid uuid The group_geo_uuid

Returns array return the airspace object

findByIndividualId

Search the airspace table for the geometry that has the specified airmap_uuid.

Parameters

  • uuid uuid The airmap_uuid

Returns array return the airspace object

search

Searches for airspace objects that match the supplied filters.

Parameters

  • filters object Filters that a user can search the airspace table on.

Returns Array<Promise.object> List of airspace objects.

getMultipleIds

getMultipleIds - Retreives airspace data for the following airmap_uuid's.

Parameters

  • ids Array<string> An array of uuids to retreive airspace data for.

Returns Array<Promise.object> description

getAvailableCountries

getAvailableCountries - Returns an array of available ISO 3166-1 alpha-3 countries in the database.

Returns Array<Promise.string> Array of country codes

getMid

getMid - Retreives the name, latitude, longitide, and metadata for a given managed object ID.

Parameters

Returns Array<Promise<object>>

getIdentifier

getIdentifier - Retreive the name and metadata for a given geo_object_id. This is used to get the Airport Identifier for generating an airport managed object ID.

Parameters

  • geo_object_id number Serial id for the geo_object in the airspace DB.

Returns Promise<object> geo object data

getMidById

getMidById - Retreive the mid and name for a given geo_object_id.

Parameters

  • geo_object_id number Serial id for the geo_object in the airspace DB.

Returns Promise<object> mid metadata

getIntersectingMIDs

getIntersectingMIDs - Retrieve the intersecting enabled and active MIDs.

Parameters

  • geometry as a GeoJSON string

Returns Promise<Array<String>>

getTemporalLayers

Query Airspace for temporal ruleset layers. Layers are not validated to ensure they are truly temporal. This is used by api-tile-data.

Parameters

Returns Array<Object>

getAdvisoriesByPolygon

getAirspaceByPolygon - Get status from a buffered path.

Parameters

  • lat float Float between -90 and 90
  • lng float Float between -180 and 180
  • polygon geojson Geometry to intersect
  • filters object types, ignored_types, and datetime filters.

Returns Promise Result

StatusClient

Extends BaseClient

This is a class for a specific database queries.

getStatusByPoint

getStatusByPoint - Get status around a point given a supplied buffer.

Parameters

  • lat float Float between -90 and 90
  • lng float Float between -180 and 180
  • buffer float buffer in meters
  • filters object types, ignored_types, and datetime filters.

Returns Promise The result

getStatusByPath

getStatusByPath - Get status from a buffered path.

Parameters

  • lat float Float between -90 and 90
  • lng float Float between -180 and 180
  • path geojson Linestring path.
  • buffer float Buffer in meters
  • filters object types, ignored_types, and datetime filters.

Returns Promise Result

getStatusByPolygon

getStatusByPath - Get status from a buffered path.

Parameters

  • lat float Float between -90 and 90
  • lng float Float between -180 and 180
  • polygon geojson Geometry to intersect
  • filters object types, ignored_types, and datetime filters.

Returns Promise Result

welcome

Retrieves all welcome summaries that intersect with as given latitude/longitude pair.

Parameters

Returns Array<Promise.object> array of intersecting jurisdictions

_getRulesetQuery

Returns a base query for selecting relevant fields for rulesets. It omits ruleset-selecting where clauses, so that this query can be customized.

Because rules and rulesets can contain multiple predicates, this query joins predicates on rules and rules on rulesets to guarantee that all of the information is returned. The data is parsed and consolidated in the API layer.

searchRulesets

Retrieves rules that apply within a specific location.

Because rules and rulesets can contain multiple predicates, this query joins predicates on rules and rules on rulesets to guarantee that all of the information is returned. The data is parsed and consolidated in the API layer.

Parameters

  • geometry object geoJSON object

Returns Array<Promise.object>

getRulesetById

Retrieves a single ruleset.

Duplicate values for rules may be generated by the inner join because a rule can have multiple flight_features attached. The data is oarsed and consolidated the Rules API.

Parameters

  • ruleset_id string ruleset unique IDs

Returns Array<Promise.object> array of rules

getRulesByRulesetIds

Retreives all rules that are a part of the given rulesets. Duplicate values for rules may be generated by the inner join because a rule can have multiple flight_features attached. The data is parsed and consolidated in the Rules API.

Parameters

  • ruleset_id Array<string> ruleset unique IDs
  • ruleset_ids

Returns Array<Promise.object> array of rules

_getUnmatchedTextRulesQuery

Base query for fetching unmatched text rules from ordinance_rule_display_text. Omits the where clause to be added as needed.

getUnmatchedTextRules

Retrieves "text-only" rules that apply to a given location. These are rules that exist in ordinance_rule_display_text and do not have a matching ordinance_rule.

Parameters

  • geometry object geoJSON object

Returns Array<Promise.object>

getUnmatchedTextRulesByUids

Retrieves "text-only" rules for a list of rulesets. These are rules that exist in ordinance_rule_display_text and do not have a matching ordinance_rule.

Parameters

  • ruleset_uids Array<string> an array containing ruleset uids

Returns Array<Promise.object>