Class: TrafficIncidentsSource

alk.source.TrafficIncidentsSource

An instance of this class provides a 'source' for the alk.layer.TrafficIncidentsLayer.

new alk.source.TrafficIncidentsSource(opt_options)

This constructor creates a Source object that collects traffic incidents from the supplied or created alk.service.TrafficIncidentsService.

Option Type Description
trafficIncidentsService alk.service.TrafficIncidentsService | undefined

This option supplies the TrafficIncidentsService to use within this source. This option is mutually exclusive with the trafficIncidentsServiceOptions options.

trafficIncidentsServiceOptions alkx.TrafficIncidentsServiceOptions | undefined

This option supplies the properties with which to create this source's internal alk.service.TrafficIncidentsService. This option is mutually exclusive with the trafficIncidentsSource option.

attributions ol.AttributionLike | undefined

This option is an OpenLayers option passed to the ol.source.XYZ super class of the alk.source.XYZSource object from its subclasses.

Attributions.

cacheSize number | undefined

This option is an OpenLayers option passed to the ol.source.XYZ super class of the alk.source.XYZSource object from its subclasses.

Cache size. Default is 2048.

extent ol.Extent | undefined

This option is an OpenLayers option passed to the ol.source.XYZ super class of the alk.source.XYZSource object from its subclasses.

It contains the map extent in which the source is relevant.

crossOrigin null | string | undefined

This option is an OpenLayers option passed to the ol.source.XYZ super class of the alk.source.XYZSource object from its subclasses.

The crossOrigin attribute for loaded images. Note that you must provide a crossOrigin value if you are using the WebGL renderer or if you want to access pixel data with the Canvas renderer. See [https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_enabled_image] for more detail.

opaque boolean | undefined

This option is an OpenLayers option passed to the ol.source.XYZ super class of the alk.source.XYZSource object from its subclasses.

Whether the layer is opaque.

maxZoom number | undefined

This option is an OpenLayers option passed to the ol.source.XYZ super class of the alk.source.XYZSource object from its subclasses.

Optional maximum zoom level. Default is 20 (ALK specific).

reprojectionErrorThreshold number | undefined

This option is an OpenLayers option passed to the ol.source.XYZ super class of the alk.source.XYZSource object from its subclasses.

Maximum allowed reprojection error (in pixels). Default is 0.5. Higher values may increase reprojection performance, but decrease precision.

wrapX boolean | undefined

This option is an OpenLayers option passed to the ol.source.XYZ super class of the alk.source.XYZSource object from its subclasses.

Whether to wrap the world horizontally. The default, undefined, is to request out-of-bounds tiles from the server. When set to false, only one world will be rendered. When set to true, tiles will be requested for one world only, but they will be wrapped horizontally to render multiple worlds.

Extends

  • ol.source.Vector

Methods

changeTrafficIncidentsService(options)

This method causes an entire refresh of this source. It does this by creating a new TrafficIncidentsService from the old one with the extended options.

Option Type Description
apiKey string

This option contains the ALK ApiKey that gives you permission to extract data from ALK Servers.

dataset alk.val.Dataset | number | string

The option contains the Dataset parameter for the Service. This option specifies an area dataset that may be pertinent to the request.

language alk.val.Language | string

This option tells the service the particular language for the results.

region alk.val.Region | number | string

This option tells the service in which region the retrieved data is to pertain. Some ALK Services switch underlying services due to this option. For instance, traffic data for North America and Europe may come from different underlying services.

srs alk.val.SRS | number | string

This option tells the service the particular projection that is used any GIS data given to the service.

hostURL string

This option contains the the host and port URL for the particular service. This option is not set by the user, but is automatically generated from the particular service being used.

path string

This option is the path part of the URL for the particular service. This option is not set by the user, but is automatically generated from the particular service being used.

boundingBox Array.<number> | string

This option holds the bounding box, or extent in which the items are requested.

getTrafficIncidents(){Array.<alkx.TrafficIncidentSpec>}

This function returns the current state of traffic incidents received by this source. This function just returns the associated traffic incident with each feature currently residing in this source.

NOTE

This returns the immediate current state of the source. If the source is in the process of updating, which could be from user interaction, such as a zoom in or out, the result may not be stable.

One may wait until the source's state, i.e. getState, is in the ol.source.State.READY state, as opposed to ol.source.State.LOADING. However, that condition is not really guaranteed at any given point in time, unless other precautions are taken.

If one desires a more stable result, use the alk.service.TrafficIncidentsService#get call with a specific pt1 and pt2 parameters defining the desired extent.

getTrafficIncidentsService(){alk.service.TrafficIncidentsService}

removeAllFeatures(features)

This method removes all features from this source.

Name Type Description
features Array.<ol.Feature>

setTrafficIncidentsService(service)

Name Type Description
service alk.service.TrafficIncidentsService