Options
All
  • Public
  • Public/Protected
  • All
Menu

Class GeoStream

Hierarchy

  • EventEmitter
    • GeoStream

Implements

Index

Constructors

constructor

  • Initializes a new instance of GeoStream.

    Returns GeoStream

Properties

Internal

Protected _addressFormatter

_addressFormatter: AddressFormatter = null

Protected _cdoltServer

_cdoltServer: GeoStreamServer = null

Protected _server

_server: GeoStreamServer = null

Static EventEmitter

EventEmitter: EventEmitter

Static defaultMaxListeners

defaultMaxListeners: number

Methods

Protected _getAddressFormats

Protected _invoke

  • Parameters

    Returns when.Promise<any>

Protected _multicall

  • _multicall(endPoint: string, method: string, params: any[][]): when.Promise<any[]>
  • Makes a single request containing multiple individual requests, for bulk requests.

    Parameters

    • endPoint: string

      the endpoint on the server which will service the request

    • method: string

      the name of the method to call

    • params: any[][]

      a list of param lists. Each item in params will be used as the params for a request to the endpoint/method pair, all of which will be sent at once as one request.

    Returns when.Promise<any[]>

    the response from the server. The results in the reponse are in the same order and position as the params, so the result at index i in the response will be the result which matches the param list at index i in params.

addListener

  • addListener(event: string | symbol, listener: Function): this
  • Parameters

    • event: string | symbol
    • listener: Function

    Returns this

addUserToCdoltLayer

  • addUserToCdoltLayer(layer: string | ILayer, usernameToAdd: string, cancelEmitter?: CancelEmitter): when.Promise<boolean>
  • Parameters

    Returns when.Promise<boolean>

autocompleteGeocode

  • A geocoder that provides autocompletion features and suggested locations based on partial address queries. Properties of the parameter are:

    • query: string
    • countries: Country[] (optional)
    • countriesZone: BoundingBox (optional)
    • locationHint: LatLon (optional)
    • timeOut: TimeSpan (optional)
    • resultsLimit: number (optional)
    • excludedResultTypes: AutocompleteGeocoderExcludedResultTypes (optional)
    • searchDepth: SearchDepth (optional)
    api

    public

    Parameters

    Returns when.Promise<AutocompleteGeocoderResult>

    The Autocomplete Geocode result.

bulkAutocompleteGeocode

  • Performs a bulk geocode using the Autocomplete Geocoder. The parameter is an array of argument objects, which are each identical to those provided to the autocompleteGeocode method.

    api

    public

    Parameters

    Returns when.Promise<AutocompleteGeocoderResult[]>

    The LocationSearch results.

bulkGeocode

  • Performs a bulk geocode using the Autocomplete Geocoder. The parameter is an array of argument objects, which are each identical to those that can be provided to the geocode method.

    api

    public

    Parameters

    Returns when.Promise<GeocodeResult[]>

    The bulk geocode results.

bulkLocationSearch

  • Performs a bulk Location Search operation. The parameter is an array of location search argument objects, which are each identical to those provided to the locationSearch method.

    api

    public

    Parameters

    Returns when.Promise<LocationSearchResult[]>

    The LocationSearch results.

bulkReverseGeocode

  • Performs a bulk reverse geocode, reverse geocoding multiple points at once.

    api

    public

    Parameters

    • args: ILatLon[]

      the list of LatLons to reverse geocode

    Returns when.Promise<Address[]>

    a list of results, which map to the args in the same order and position.

bulkReverseGeocodeFull

  • Performs a full bulk reverse geocode, reverse geocoding multiple points at once.

    api

    public

    Parameters

    Returns when.Promise<ReverseGeocodeResult[]>

    a list of results, which map to the args in the same order and position.

deleteCdoltLayer

  • deleteCdoltLayer(layer: string | ILayer, cancelEmitter?: CancelEmitter): when.Promise<boolean>
  • Parameters

    Returns when.Promise<boolean>

destringifyLayers

  • destringifyLayers(allLayers: any[]): when.Promise<any[]>
  • Given an array of layers, converts any layers represented in string form to the ILayer object of the same name. Objects that are not strings are left as-is.

    api

    public

    Parameters

    • allLayers: any[]

      The layers to destringify. Layers can be GeoStream layers (either the name of a known layer, or an ILayer object) or layers from another source (of any type).

    Returns when.Promise<any[]>

    The converted layers.

emit

  • emit(event: string | symbol, ...args: any[]): boolean
  • Parameters

    • event: string | symbol
    • Rest ...args: any[]

    Returns boolean

emitError

  • emitError(error: string): void
  • Emits an error to error event listeners.

    api

    public

    Parameters

    • error: string

      The error message to emit.

    Returns void

eventNames

  • eventNames(): (string | symbol)[]
  • Returns (string | symbol)[]

findCdoltNearestLines

  • findCdoltNearestLines(layer: string | ILayer, location: LatLon, tableName: string, simplificationLevel?: number, cancelEmitter?: CancelEmitter): when.Promise<Line[]>
  • Parameters

    • layer: string | ILayer
    • location: LatLon
    • tableName: string
    • Optional simplificationLevel: number
    • Optional cancelEmitter: CancelEmitter

    Returns when.Promise<Line[]>

findCdoltNearestPoints

findCdoltNearestPolygons

  • findCdoltNearestPolygons(layer: string | ILayer, location: LatLon, tableName: string, simplificationLevel?: number, cancelEmitter?: CancelEmitter): when.Promise<Polygon[]>
  • Parameters

    • layer: string | ILayer
    • location: LatLon
    • tableName: string
    • Optional simplificationLevel: number
    • Optional cancelEmitter: CancelEmitter

    Returns when.Promise<Polygon[]>

findNearbyPopulationCenter

  • findNearbyPopulationCenter(location: ILatLon, maxDistance: number, minPopulation: number, sizeFactor: number, cancelEmitter?: CancelEmitter): when.Promise<Address>
  • Finds a nearby population center (usually a city) based on distance and population criteria.

    api

    public

    Parameters

    • location: ILatLon

      The location from which to search.

    • maxDistance: number

      The maximum search radius, in meters, from the location.

    • minPopulation: number

      The minimum population of the population center. Use 0 to include all population centers.

    • sizeFactor: number

      A value between 0 and 1, used to determine the relative weight of distance vs population. When set to 0, the closest population center within the search area will be returned (proximity only). When set to 1, the largest population center within the search area will be returned (population only). Between 0 and 1, results will be weighted based on an interpolated score incorporating proximity and population. A value near 0.3 (mostly proximity but partly population) generally provides good results, but experimentation is recommended based on the particular use case.

    • Optional cancelEmitter: CancelEmitter

      A CancelEmitter used to cancel the request (optional).

    Returns when.Promise<Address>

    the address of the nearby population center, or null if no suitable candidates were found within the search area.

format

  • Asynchronously formats an address, giving the result in the specified format.

    api

    public

    Parameters

    Returns when.Promise<string | string[]>

    the formatted address

geocode

  • Performs a geocode. Possible parameter types are:

    IOneLineGeocodeArgs:

    • oneLineAddress

    IStructuredGeocodeArgs:

    • address
    • city
    • region
    • postalCode

    StreetStructuredGeocodeArgs:

    • number
    • prefix;
    • streetTypeBefore
    • name
    • streetTypeAfter
    • suffix
    • city
    • region
    • postalCode
    api

    public

    Parameters

    Returns when.Promise<GeocodeResult[]>

    The geocode result.

getAddressFormatter

  • Retrieves the address formatter which uses this geostream as a format source.

    api

    public

    Returns AddressFormatter

    The formatter

getAllLayers

  • Gets all possible layers that can be used with both the main GeoStream server, and any configured CDOLT server. Layers are represented as geobase.ILayer objects.

    Instead of using the returned promise, you can listen for an appropriate event: geostreamReady is raised when the main GeoStream server returns layers, cdoltReady is raised when any CDOLT server returns layers, ready is raised when all servers (the main GeoStream server, and the CDOLT server, if applicable) have returned layers, and layersLoaded is raised each time any layers are loaded. layersLoaded provides just those layers that have been loaded incrementally, while the other handlers return all applicable layers that habe been loaded.

    api

    public

    Parameters

    Returns when.Promise<ILayer[]>

    The possible layers.

getAuthModeForLayer

  • Gets the authentication mode for the layer.

    Parameters

    • Optional layer: Layer

      The layer for which to get the authentication mode

    Returns TileAuthenticationMode

    The authentication mode for the layer

getAuthToken

  • getAuthToken(username: string, password: string, expiry?: TimeSpan, cancelEmitter?: CancelEmitter): when.Promise<string>
  • Authenticates the given user against the main GeoStream server and returns an auth token.

    api

    public

    Parameters

    • username: string

      the name of the user

    • password: string

      the password of the user

    • Optional expiry: TimeSpan
    • Optional cancelEmitter: CancelEmitter

    Returns when.Promise<string>

    An auth token for the user

getCdoltLayers

  • Gets all possible layers that can be used with the specified CDOLT server. See getAllLayers for event handling information.

    api

    public

    Parameters

    Returns when.Promise<CdoltLayer[]>

    The possible layers.

getCompositeLayers

  • getCompositeLayers(allLayers: any[]): any[]
  • Given a list of layers, gets the composite layers representing the layers from which layers should be generated. This is often done by combining multiple layers into one. Layers will combine only when the specific layers allow this, in accordance with the ICombinable interface.

    api

    public

    Parameters

    • allLayers: any[]

      The layers to join. They should be destringified prior to calling this method. Layers can be GeoStream ILayer objects, or layers from another source (of any type).

    Returns any[]

    The composite layers.

getCopyrightString

  • getCopyrightString(cancelEmitter?: CancelEmitter): when.Promise<string>
  • Gets the copyright string of the main GeoStream server.

    api

    public

    Parameters

    Returns when.Promise<string>

    The copyright string.

getCorrectedLocation

  • Gets a CorrectedLocation for a point that has been moved to the correct side of a street matching the provided address.

    api

    public

    Parameters

    • location: ILatLon

      the physical location of the address that is correct to within a small tolerance. For example, this location is usually recorded at the physical address by a driver using a GPS unit.

    • streetNumber: string

      the number of the target address

    • streetName: string

      the name of the street of the target address

    Returns when.Promise<CorrectedLocation>

    A CorrectedLocation containing corrected intersection and display LatLons for the address, and the confidence in the accuracy of the result.

  • Gets a CorrectedLocation for a point that has been moved to the correct side of a street matching the provided address.

    api

    public

    Parameters

    • location: ILatLon

      the physical location of the address that is correct to within a small tolerance. For example, this location is usually recorded at the physical address by a driver using a GPS unit.

    • address: string

      the address which contains a street number and a street name.

    Returns when.Promise<CorrectedLocation>

    A CorrectedLocation containing corrected intersection and display LatLons for the address, and the confidence in the accuracy of the result.

getCustomLocationSearchArgs

  • Gets a list of custom arguments for all search sources that can be specified in the CustomArgs property of a LocationSearchArgs object. There are no parameters.

    api

    public

    Parameters

    Returns when.Promise<CustomLocationSearchArg[]>

getDirections

  • Gets directions. Properties of the parameter are:

    • stops
    • strategy
    • vehicleSpec (optional)
    • trafficServer (optional)
    • unitSystem
    • culture
    api

    public

    Parameters

    Returns when.Promise<Directions>

    The directions result.

getGeostreamLayers

  • Gets all possible layers that can be used with the main GeoStream server. See getAllLayers for event handling information.

    api

    public

    Parameters

    Returns when.Promise<ILayer[]>

    The possible layers.

getMaxListeners

  • getMaxListeners(): number
  • Returns number

getPath

  • Calculates a route and returns a representative Directions object without textual driving instructions. Properties of the parameter are:

    • stops
    • strategy
    • vehicleSpec (optional)
    • trafficServer (optional)
    api

    public

    Parameters

    Returns when.Promise<Directions>

    The directions result.

getResolvedServerInfoForLayer

  • Gets the server info for a layer.

    api

    public

    Parameters

    • Optional layer: Layer

      The layer for which to get the server info

    Returns ServerInfo

    The server

getRouteHighlight

  • Gets a route highlight based on the likely route a vehicle has taken (given a series of location readings). Properties of the parameter are:

    • stops (optional)
    • dataUrl (optional)
    • strategy
    • currentTime (optional)
    api

    public

    Parameters

    Returns when.Promise<Directions>

    The directions result.

getServerForLayer

  • Gets the server URL for a layer. Note that if multiple subdomains are used, one will be selected arbitrarily.

    api

    public

    Parameters

    • layer: Layer

      The layer for which to get the server URL.

    • Optional cancelEmitter: CancelEmitter

    Returns when.Promise<string>

    The server URL.

getServerInfo

  • Gets the ServerInfo of the main GeoStream server

    api

    public

    Parameters

    • Optional layer: Layer
    • Optional cancelEmitter: CancelEmitter
    • Optional ignoreCached: boolean

    Returns when.Promise<ServerInfo>

    The ServerInfo object corresponding to the GeoStream server.

getSubdomains

  • getSubdomains(layer: Layer): when.Promise<string[]>
  • Gets the subdomains for the server associated with the specified layer. These are the same subdomains provided when the GeoStream was configured by calling the use function.

    api

    public

    Parameters

    • layer: Layer

      The GeoStream layer to check subdomains for.

    Returns when.Promise<string[]>

    A list of subdomains.

getTileTemplateUrl

  • Gets the template URL for a layer, that can be provided (for example) to a Leaflet layer to generate tile requests.

    api

    public

    Parameters

    • layer: Layer

      The layer for which to get a template URL.

    • Optional cancelEmitter: CancelEmitter

    Returns when.Promise<string>

    The template URL.

getTraffic

  • getTraffic(source: string, cancelEmitter?: CancelEmitter): when.Promise<any[]>
  • Gets current traffic information. Returns an array of values in the form [currentTime, expiryTime], where currentTime is the date that the traffic information was last updated, and expiryTime is the number of seconds until it should be refreshed.

    api

    public

    Parameters

    Returns when.Promise<any[]>

    The traffic information.

getVectorStyle

  • getVectorStyle(name: string, minSpecVersion: number, maxSpecVersion: number): when.Promise<IVectorStyle>
  • Gets a style for a vector map from the GeoStream. The latest version of the style which is between the given minimum and maximum versions (inclusive) will be fetched.

    Parameters

    • name: string

      The name of the style to fetch. Available styles are listed in the ServerInfo.

    • minSpecVersion: number

      The minimum allowable spec version of the style.

    • maxSpecVersion: number

      The maximum allowable spec version of the style.

    Returns when.Promise<IVectorStyle>

    A promise for a style, resolved with the style if a matching style exists, or null otherwise.

listenerCount

  • listenerCount(type: string | symbol): number
  • Parameters

    • type: string | symbol

    Returns number

listeners

  • listeners(event: string | symbol): Function[]
  • Parameters

    • event: string | symbol

    Returns Function[]

locationSearch

  • LocationSearch provides a single API to search for locations across different sources, such as: geocoders, POI sources, and reverse geocoders. Properties of the parameter are:

    • query: string
    • queryForm: QueryForm (optional)
    • searchDepth: SearchDepth (optional)
    • resultTypes: LocationSearchResultType (optional)
    • poiTypes: PoiType[] (optional)
    • countries: Country[] (optional)
    • locationHint: LatLon (optional)
    • timeout: TimeSpan (optional)
    • resultsLimit: number (optional)
    • customArgs: Object (optional)
    api

    public

    Parameters

    Returns when.Promise<LocationSearchResult>

    The LocationSearch result.

on

  • on(event: string | symbol, listener: Function): this
  • Parameters

    • event: string | symbol
    • listener: Function

    Returns this

once

  • once(event: string | symbol, listener: Function): this
  • Parameters

    • event: string | symbol
    • listener: Function

    Returns this

optimizeRoute

  • Optimizes a route. Properties of the parameter are:

    • stops
    • strategy
    • vehicleSpec (optional)
    • trafficServer (optional)
    api

    public

    Parameters

    Returns when.Promise<IRoute>

    The optimized route.

prependListener

  • prependListener(event: string | symbol, listener: Function): this
  • Parameters

    • event: string | symbol
    • listener: Function

    Returns this

prependOnceListener

  • prependOnceListener(event: string | symbol, listener: Function): this
  • Parameters

    • event: string | symbol
    • listener: Function

    Returns this

queryCdoltLayerIndex

  • Gets the layer index for the specified CDOLT layer.

    Parameters

    • layer: string | ILayer
    • operator: Operator
    • value: any
    • Optional firstResult: number
    • Optional simplificationLevel: number
    • Optional cancelEmitter: CancelEmitter

    Returns when.Promise<QueryResult>

queryCdoltLines

  • Parameters

    Returns when.Promise<Line[]>

queryCdoltPOI

  • Parameters

    Returns when.Promise<Poi[]>

queryCdoltPoints

queryCdoltPolygons

  • Parameters

    Returns when.Promise<Polygon[]>

queryCdoltPolygonsAtPoint

  • queryCdoltPolygonsAtPoint(layer: string | ILayer, location: LatLon, tableName: string, simplificationLevel?: number, cancelEmitter?: CancelEmitter): when.Promise<Polygon[]>
  • Parameters

    • layer: string | ILayer
    • location: LatLon
    • tableName: string
    • Optional simplificationLevel: number
    • Optional cancelEmitter: CancelEmitter

    Returns when.Promise<Polygon[]>

queryLinks

  • Gets an array of StreetLinks that lie underneath the given BoundingBox.

    Parameters

    • bbox: IBoundingBox

      The BoundingBox representing the area to be queried.

    Returns when.Promise<StreetLink[]>

    An array of StreetLinks including all StreetLinks that with BoundingBoxes that intersect with the given BoundingBox.

refreshServerInfo

  • Refresh the ServerInfo of the main GeoStream server

    api

    public

    Parameters

    Returns when.Promise<ServerInfo>

    A promise that returns the ServerInfo object corresponding to the GeoStream server.

removeAllListeners

  • removeAllListeners(event?: string | symbol): this
  • Parameters

    • Optional event: string | symbol

    Returns this

removeListener

  • removeListener(event: string | symbol, listener: Function): this
  • Parameters

    • event: string | symbol
    • listener: Function

    Returns this

removeUserFromCdoltLayer

  • removeUserFromCdoltLayer(layer: string | ILayer, usernameToRemove: string, cancelEmitter?: CancelEmitter): when.Promise<boolean>
  • Parameters

    Returns when.Promise<boolean>

renameCdoltLayer

  • renameCdoltLayer(layer: string | ILayer, newLayerName: string, cancelEmitter?: CancelEmitter): when.Promise<boolean>
  • Parameters

    Returns when.Promise<boolean>

reportClientStats

  • reportClientStats(stats: any, cancelEmitter?: CancelEmitter): void
  • Parameters

    Returns void

reverseGeocode

  • Performs a reverse geocode. Properties of the parameter are:

    • location
    • speed (optional)
    • useGlobalFallback (optional)
    • maxCrossStreetDistance (optional)
    • heading (optional)
    • streetNames (optional)
    • maxDistance (optional)
    • alignSearchLimitDistance (optional)
    • useRoadWidth (optional)
    • reverseGeocodeMode
    api

    public

    Parameters

    Returns when.Promise<ReverseGeocodeResult>

    The reverse geocode result.

setMaxListeners

  • setMaxListeners(n: number): this
  • Parameters

    • n: number

    Returns this

use

  • Configures the GeoStream for use with the specified server(s).

    The configuration parameter should include the following properties:

    • servers: an array of servers, from which the fastest to respond will be selected. Each array element can be either a) a string containing the URL of a GeoStream; or b) An object containing two properties: url, specifying a template URL containing '{s}', and subdomains, which is an array of subdomain strings. In this case, the map will substitute in subdomains in place of '{s}' for different tile requests to improve performance by avoiding browser limits on the number of requests to a single server. As one subdomain will be chosen arbitrarily for authentication, all subdomains should point to the same GeoStream server.
    • username (optional): a valid username for the server(s).
    • password (optional): a valid password that corresponds to the username. Required if username is specified.
    • authtoken (optional): an authentication token for the server. Can be used instead of username and password.
    • tileAuthentication (optional): a geobase.TileAuthenticationMode value, specifying how authentication is handled for tile requests. Possible values are:
      • TileAuthenticationMode.None: No authentication is used for tiles. Best option for use with CloudFront.
      • TileAuthenticationMode.Cookie (default): The authtoken is stored as a cookie. Best option for most servers, where cookies are supported. Cannot be used with servers that have multiple subdomains.
      • TileAuthenticationMode.Url: The authtoken is specified in the query string of each tile request. Best option when authentication is required, and when multiple subdomains are used.
    • cdolt (optional): configuration for a CDOLT server. Possible properties are the same as those of the root configuration parameter (servers, username, password, authtoken, and tileAuthentication).

    Return a promise that contains a list of authtokens for the configured server(s). Alternatively, you can listen for the geostreamConfigured, cdoltConfigured, and allConfigured events.

    api

    public

    Parameters

    Returns when.Promise<string[]>

    The auth tokens of the configured servers.

validateAndAggregateLayers

  • validateAndAggregateLayers(allLayers: any[]): when.Promise<any[]>
  • Destringifies, validates and then aggregates layers. Throws an error on validation failure, or otherwise returns a list of layers that can be used to generate tile layers.

    api

    public

    Parameters

    • allLayers: any[]

      The layers to validate and join. Layers can be GeoStream layers (either the name of a known layer, or an ILayer object) or layers from another source (of any type).

    Returns when.Promise<any[]>

    The composite layers.

validateLayers

  • validateLayers(allLayers: any[]): void
  • Validates a list of layers, checking that they satisfy the requirements of a GeoStream server. Throws an error if there are any validation failures.

    api

    public

    Parameters

    • allLayers: any[]

      The layers to validate. They should be destringified prior to calling this method. Layers can be GeoStream ILayer objects, or layers from another source (of any type).

    Returns void

Static listenerCount

  • listenerCount(emitter: EventEmitter, event: string | symbol): number
  • Parameters

    • emitter: EventEmitter
    • event: string | symbol

    Returns number

Static standardiseServerPath

  • standardiseServerPath(server: string): string
  • Parameters

    • server: string

    Returns string

Generated using TypeDoc