Class: Service

alk.service.Service

An instance of this object creates the URL needed based on options and defaults to access ALK services.

new alk.service.Service(opt_options)

This constructor is one above the base constructor, which is meant to be subclassed. Its base functionality is to process options from the ALK API down to the lower level PCMWS level API, which is not seen by the general developer.

Option Type Description
afSetIds Array.<(string|number)> | string

This option lists the avoid/favor sets to the route.

apiKey string

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

avoidFavors boolean | number | string

This option tells the service whether or not to use avoids and favors while routing.

avoidTolls boolean | number | string

This option tells the service to avoid toll roads and bridges while creating the route.

axles number | string

This option contains the number of axles on the vehicle.

boundingBox Array.<number> | string

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

center Array.<number> | string

This option contains the center of the search.

certainty alk.val.Certainty | number | string

This option specifies a search filter on the Certainty. Default is alk.val.Certainty.All.

city string

This option specifies the city that will be used to search.

citySearchFilter string

This option specifies the city search filter to use. TODO: Various values?

classOverrides Array.<(alk.val.OverrideClass|number)> | string deprecated

This option tells the service the travel class overrides. Use 'classOverrides'.

codes Array.<string> | string

This option specifies the FIPS codes for counties in the search.

coords Array.<string> | string

This options specifies the coordinates with which to restrict the search. The projection must be EPSG:4356.

countries Array.<string> | string

This option specifies the countries for the search. They must be in the form specified by the countryType parameter.

countryType string

This option specifies the country type abbreviation the countries parameter is using.

currentSpeed number | string

This option specifies speed of the vehicle in Miles Per Hour.

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.

display alk.val.Display | number | string

This option tells the service the display type in which to return image data or tiles.

distanceUnits alk.val.DistanceUnits | number | string

This option tells the service that any distance measurements will be delivered in these units, such as alk.val.DistanceUnits.Kilometers or alk.val.DistanceUnits.Miles.

drawerGroups Array.<(alk.val.DrawerGroup|number)> | string

The DrawerGroups parameter for the Service.

elevationLimit number | string

This option tells the service the distance above sea level to keep the route. Its value is interpreted according to the 'distanceUnits' option.

endTime string

The time before which to search for weather alerts. Use standard formats such as ISO8601("2015-08-29T13:45:30-07:00") or RFC1123("Sat, 29 Aug 2015 20:45:30 GMT").

estimatedTimeOpts string

This option contains the parameter for the estimated time optimizations. This option only affects routing when roads have time based restrictions. Format is described by this BNF notation:

  • fmt ::= DA ('|' Time)?
  • Time :: = DayTime | SpecificDateTime
  • DA ::= 'Depart' | 'Arrive'
  • DayOfWeek ::= 'Monday' | 'Tuesday' | ... | 'Sunday';
  • DayTime ::= DayOfWeek '|' TimeOfDay ('|' TimeZone)?
  • SpecificDateTime ::= YYYY-MM-DDTHH:MM:SS ('|' TimeZone)?

Examples are: -- Arrive|Monday|18:53|Local -- Depart|2016-04-23T09:43:20|Local -- Arrive (meaning system time)

eventNames Array.<string> | string

This option specifies a search filter on the event names, such as ["Winter Storm Warning", "Flood Watch"].

excludeSearchTypes Array.<string> | string

This option specifies the search types to exclude when analysing the query of the search. Their values must come from the alk.service.SearchTypesSingleSearchService.

ferryDiscourage boolean | number | string

This option tells the service to avoid ferries when creating the route.

format alk.val.Format | number

This option tells the Service in which format to deliver its image data.

governorSpeedLimit number | string

This option tells the service the maximum average road speed to use in route calculations that overrides all other road speeds when the are above this value. Default is disabled and valid values are between 1 and 100mph. TODO: Is this always in MPH when distanceUnits is Kilometers?

hazMat alk.val.HazMat | number | string

This option tells the service the hazardous material type.

hazMatType alk.val.HazMat | number | string deprecated

This option tells the service the HazMat conditions in effect. Use 'hazMat'.

heading string | number

This option specifies heading. The value is in degrees counter clockwise from East. East = 0, North = 90, West = 180 , South = 270.

height number | string

This option tells the service the height in which to return image data or tiles. The value is in pixels.

highwayOnly boolean | number | string

This option tells the service to generate a route that will travel mostly along highways.

histDay alk.val.HistDay | number | string

This option tells the service the history in which to return image data or tiles. TODO: Better description.

histTimeBin number | string

This option tells the service the history in which to return image data or tiles. TODO: Better description.

histTimeZone string

This option tells the service the history in which to return image data or tiles. TODO: Better description.

hosEnabled boolean | number | string

This option enables insertion of Hours Of Service Stops.

hosRemCycleDutyTime number | string

This option indicates the available 'Cycle Time Duty' hours available at the origin until a cycle reset.

hosRemDriveTime number | string

This option indicates the available driving hours at the origin until the end of the workday.

hosRemDriveTimeUntilBreak number | string

This option indicates the available driving hours at the origin before the driver needs to take a rest break.

hosRemOnDutyTime number | string

This option indicates the available 'On-Duty' hours at the origin until the end of the work day.

hosRuleType alk.val.HosRuleType | number | string

This option indicates the hours of service rule to use. Valid values are alk.val.HosRuleType.USFed607H or alk.val.HosRuleType.USFed708H for US Federal Long Haul rules.

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.

hourOffset number | string

This option tells the service the hour offset in which to return image data or tiles. TODO: Better description.

hubRouting boolean | number | string

This option tells the service if 'hub routing' is in effect. This means that the starting stop is the hub. The last stop is in effect, not a destination, but a turn around point.

identifier string

The string that identifies the camera.

imgOption alk.val.ImgOption | number | string

This option tells the service which way to deliver the image data. Available values are 'Background', 'Foreground', and 'Both'.

imgSrc alk.val.ImgSrc | number | string

This option tells the service from where to get its image data. The available names, such as 'Sat1' and 'Sat2', have specific designations with ALK. Please see {TODO: Need Reference Here} for a current description.

includeLinkInfo boolean | number | string

This option specifies the response to include link identifier information.

includePostedSpeedLimit boolean | number | string

This option specifies the response to include the posted speed limit information. Good only for ALK licenses that include speed limit.

language alk.val.Language | string

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

lcv boolean | number | string

This option tells whether the truck is a multi-trailer or longer combination vehicle.

list number | string

This option tells the service how many results to return.

matchNamedRoadsOnly boolean | number | string

This option is tells the service that when it is looking up coordinates to force reverse geocoding to match named roads only.

maxCleanupMiles number | string

This option is tells the service that when it is looking up coordinates sets maximum radius in which to find the closest matching road.

maxResults number | string

This option specifies the max number of results to return. It must be between 1 and 100, inclusive.

minutes number | string

This option contains the number of driving minutes, with which to size the polygon.

nameFilter string

The results will be filtered by a likeness to this name;

openBorders boolean | number | string

This option tells the service if the borders are open for travel.

overrideClass Array.<(alk.val.OverrideClass|number)> | string

This option tells the service the classes of vehicle travel. Such as alk.val.OverrideClass.NationalNetwork or alk.val.OverrideClass.FiftyThreeFoot.

overrideRestrict boolean | number | string

This option tells the service whether to override truck restrictions.

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.

poiCategories Array.<string> | string

This options specifies the Points of Interest categories with which to restrict the search. Their values must come from the alk.service.POICategoriesSingleSearchService.

point Array.<number> | string

TODO: What does point mean for WeatherAlerts.

postCode string

This option contains the postal code to use in the search.

postCodeFilter string

This option contains the postal code filter to use in the search. The service uses this option to filter zip codes by country. For example, use 'US' to indicate US zip codes only. Use 'EM' to indicate Mexican postal codes only. Use a sequence of country codes for multiple. TODO: Are they separated by commas?

provider alk.val.Provider | number | string

This option tells the service the provider in which to return image data or tiles. The options are Default or RC1.

pt1 Array.<number> | string

This option pertains to only those services that return single images where the options pt1 and pt2 represent the NorthWest and SouthEast coordinates,respectively. This option holds the NorthWest coordinate.

pt2 Array.<number> | string | undefined

This option pertains to only those services that return single images where the options pt1 and pt2 represent the NorthWest and SouthEast coordinates,respectively. This option holds the SouthEast coordinate.

radius number | string

This option contains the radius in radiusUnits of the search.

radiusUnits alk.val.DistanceUnits | number | string

This option contains the units with which to interpret the radius option.

reduceResponsePoints boolean | number | string

This option tells the service whether to reduce the number of response points.

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.

requestId number | string | undefined

This option contains a caller provided id that will be residing on the options when the call is returned. This parameter helps identify the request. It does not get transmitted to the server.

routeDuration number | string

This option tells the service the duration route for which to get the road conditions.

routeOpt alk.val.RouteOptimization | string | undefined

This option tells the service the level of route optimization to use.

routeOptimization alk.val.RouteOptimization | number | string deprecated

This option tells the service what level of route optimization to perform. Use 'routeOpt'.

routePath Array.<Array.<number>>

This option tells the service the route for which to get the road conditions.

routePathRequest alkx.route.RoutePathRequest | string

This option contains the full route path request to give to the alk.service.RoutePathService. It can be an object, which is the request, or a JSON.stringified version of it.

routeType alk.val.RouteType | number | string

This option tells the service the type of the route requested. It can be alk.val.RouteType.Practical or alk.val.RouteType.Shortest.

routingType alk.val.RouteType | number | string deprecated

This option tells the route type. See alkx.RouteServiceOptions#routeType.

setId number | string

This option contains the setId that names to which the subsequent calls will pertain.

severity alk.val.Severity | number | string

This option specifies a search filter on the Severity. Default is alk.val.Severity.All.

sideOfStreetAdherence number | string

This option indicates the strictness in avoiding the opposite side of the street at the destination. TODO: What is the number range? 0-1?

splc string

This option contains the Standard Point Lookup Code. It is used in place of using street/city/state/zip.

srs alk.val.SRS | number | string

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

startTime string

The time after which to search for weather alerts. Use standard formats such as ISO8601("2015-08-29T13:45:30-07:00") or RFC1123("Sat, 29 Aug 2015 20:45:30 GMT").

state string

This option contains the state (or provence) to use in the search.

states Array.<string> | string

This option specifies the states with which to restrict the search. Their values must come from the "Abbrev" attribute of states returned from the alk.service.StatesSingleSearchService.

stopTypes Array.<alk.val.StopType> | Object.<number, alk.val.StopType>

This option contains an ordered array or indexed object map of the types of each stop given in the 'stops' option.

stops Array.<Array.<number>>

This option contains the stops that the route is to travel along. It is supplied in Spherical Mercator unless, specified by the 'srs' option. It contains an ordered array of coordinates from origin to destination.

stopsAsViaPoints boolean | number | string

This option tells the service that all stops in between the origin and the destination are to be treated as not a stop, but a via point.

street string

This option contains the state (or provence) to use in the search.

strokeWidth number | string

This option tells the service the stroke width to use in drawing the traffic.

style alk.val.Style | number | string

This option tells the service the style of map that is requested. ALK has a number of different map styles, such as alk.val.Style.Night, and alk.val.Style.Terrain.

timeOffset string

This option tells the service the offset in time in which to return image weather data or tiles.

TODO: Format?

tollDiscourage boolean | number | string deprecated

This option tells the service to avoid tolls. Use 'avoidTolls'.

trkAxles number | string deprecated

This option contains the number of axles on the vehicle. Use 'axles'.

trkHeight number | string deprecated

This option contains the height of the vehicle. Use 'vehicleHeight'.

trkLCV boolean | number | string deprecated

This option indicates whether the vehicle is a multi-trailer or longer combination. Use 'lcv'.

trkLength number | string deprecated

This option contains the length of the vehicle. Use 'vehicleLength'.

trkUnits alk.val.VehicleDimensionUnits | number | string deprecated

This option contains the measurement units for the vehicle. Use 'vehicleDimensionUnits'.

trkWeight number | string deprecated

This option contains the weight of the vehicle. Use 'vehicleHeight'.

trkWidth number | string deprecated

This option contains the width of the vehicle. Use 'vehicleWidth'.

truckConfig alk.val.TruckConfig | number | string

This option specifies the particular vehicle configuration, such as alk.val.TruckConfig.FullSizeVan, etc.

urban boolean | number | string

This option specifies that the search is in an urban area.

urgency alk.val.Urgency | number | string

This option specifies a search filter on the Urgency. Default is alk.val.Urgency.All.

vehicleDimensionUnits alk.val.VehicleDimensionUnits | number | string

This option tells the service in what units, metric or otherwise, the vehicle measurements are presented. Can be either

vehicleHeight number | string

This option contains the height measurement of the vehicle.

vehicleLength number | string

This option contains the length measurement of the vehicle.

vehicleType alk.val.VehicleType | number | string

This option tells the service the type of vehicle that is requesting the route.

vehicleWeight number | string

This option contains the weight measurement of the vehicle.

vehicleWidth number | string

This option contains the width measurement of the vehicle.

width number | string

This option tells the service the width in which to return image data or tiles. The value is in pixels.

borderWait number | string | undefined

TODO: write description

breakInterval number | string | undefined

TODO: write description

breakLength number | string | undefined

TODO: write description

citeInterval number | string | undefined

TODO: write description

condenseDirections boolean | number | string | undefined

TODO: write description

costGreenHouseGas number | string | undefined

TODO: write description

costMaintenanceEmpty number | string | undefined

TODO: write description

costMaintenanceLoad number | string | undefined

TODO: write description

costPerFuelUnit number | string | undefined

TODO: write description

costTimeEmpty number | string | undefined

TODO: write description

costTimeLoad number | string | undefined

TODO: write description

customRoadSpeeds string | undefined

TODO: write description

exchangeRate number | string | undefined

TODO: write description

fuelEconomyEmpty number | string | undefined

TODO: write description

fuelEconomyLoad number | string | undefined

TODO: write description

fuelUnits alk.val.FuelUnits | number | string | undefined

TODO: write description

includeFerryDistance boolean | number | string | undefined

TODO: write description

includeTollData boolean | number | string | undefined

TODO: write description

remainingHoursOfService number | string | undefined

TODO: write description

reportFormat alk.val.ReportFormat | number | string | undefined

TODO: write description

reports Array.<(alk.val.Report|number)> | string | undefined

TODO: write description

routeId string | undefined

TODO: write description

stopCosts Array.<(alkx.StopCost|string)> | string | undefined

TODO: write description

tHoursWithSeconds number | string | undefined

TODO: write description

tollCurrency alk.val.TollCurrency | number | string | undefined

TODO: write description

tollPlan Array.<(alk.val.TollPlan|number)> | string | undefined

TODO: write description

useTraffic boolean | number | string | undefined

TODO: write description

Subclasses

Extends

Methods

get(opts_or_callback, responseCallback){*|undefined}

This method performs a request to this configured service using the supplied options, options set on the constructor, and defaults. The response is handled asynchronously by a callback.

This method calls on possibly sub-classed methods:

  • getServiceOptions to combine and extend call options with the base options
  • processResponse to process the response before handing it off to the responseCallback.

NOTE

The primary function of a service is to generate a URL. Although this call exists on this object, this get call may not be used by certain components, such as alk.source.XYZSource. That is because the tile source will just use getURL call to get the URL, which may be a template with {x}, {y}, {z}, and make the get XHR requests on its own. Therefore, the intercept points, such as processResponse will not be engaged for those calls.

Name Type Description
opts_or_callback Object | function

This parameter contains any options that override options that are set on this object for this particular request.

responseCallback function

This parameter is the function that handles the response.

getAttribution(opts_or_callback, responseCallback){*|undefined}

This method performs a request to this configured service using the supplied options, options set on the constructor, and defaults to get the service's attribution, should it have one. This call results in Object, which may be a parsed JSON response.

Name Type Description
opts_or_callback Object | function

This parameter contains any options that override options that are set on this object for this particular request.

responseCallback function

This parameter is the function that handles the response.

getServiceOptions(options){Object} inherited

This method returns the base options that was used to create this Service object and override them with the given options;

Name Type Description
options Object
Returns:
The combined options.

getURL(opt_options){string}

Returns the URL for the service based on the given options, options set on the constructor, and defaults.

Name Type Description
options Object

These options override any relevant options that are set on the object at its construction.

processResponse(options, obj){Object}

This method processes the response from the server before it gives it to the callback. The default is to pass through.

NOTE

This intercept point will only be called if the request was initiated with the get call.

Name Type Description
options Object

The call options combined with the base options used for the call.

obj Object

The object received from the server.