A utility class can be used to consume ALK mapping, geocoding, and routing services.
| ALKMaps. | A utility class can be used to consume ALK mapping, geocoding, and routing services. |
| Functions | |
| getCustomPlace | Get custom places for a given account. |
| updateCustomPlaceSet | Update custom place set’s name, and tag for a given set id and tag. |
| deleteCustomPlaceSet | Delete custom place set for a given id. |
| deleteCustomPlace | Delete custom place. |
| getCustomCategories | Get custom categories. |
| addCustomCategory | Add custom category. |
| updateCustomCategory | Update custom categories. |
| getReports | Takes coords objects and report options, return total time and total distance synchronously. |
| getRoutePath | Takes coords objects and route options, return lat/lons for the route path. |
| addAvoidFavorSet | Add a new avoid/favor set. |
| getAvoidFavorSets | Retrieves all AvoidFavorSets, one specific set if the setId is specified. |
| updateAvoidFavorSet | Update name and tag based on set Id. |
| deleteAvoidFavorSet | Deletes the AvoidFavor set. |
| addAvoidFavor | Add a new set with closure. |
| deleteAvoidFavor | Deletes a specific AvoidFavors within a set. |
services.getCustomPlaces = function ( inputs )
Get custom places for a given account.
| inputs | {Object} Accept id, tag and bounds properties. |
| id | {Number} Custom places set id. |
| tag | {String} Custom places set tag. (optional) |
| bounds | {ALKMaps.Bounds} Tile bounds for custom places within this box. |
| placeName | {String} refine the results by optional custom place name. (optional) |
| catId | {Number} refine the results by optional custom category id. (optional) |
| catName | {String} refine the results by optional custom category name. (optional) |
| success | {function} callback function called after success with the return object as a parameter. (optional) |
| failure | {function} callback function called after failure with the return object as a parameter. (optional) |
ALKMaps.Services.getCustomPlaces({
id: 82,
catId: 61,
bounds: {left: -80,top: 40,bottom: 50,right: -70},
success: function(response){}
});An example of retured object [{“SetID”:9,”SetName”:”Walmart”,”SetTag”:”AccountId:3”,”CustomPlaces”:[{“Address”:{“StreetAddress”:”1400 W WABANSIA AVE”,”City”:”CHICAGO”,”State”:””,”Zip”:”60622”,”County”:”US”,”Country”:null,”SPLC”:null,”CountryPostalFilter”:0,”AbbreviationFormat”:0},”Coords”:{“Lat”:”41.913408”,”Lon”:”-87.663022”},”Region”:4,”Label”:null,”PlaceName”:”TACTICA INTERNATIONAL LLC 3”,”PlaceId”:185186,”PlaceType”:null,”Phone”:null,”Category”:null}]}]
services.updateCustomPlaceSet = function( inputs )
Update custom place set’s name, and tag for a given set id and tag.
| inputs | {Object} |
| id | {Number} the existing custom place set id. |
| name | {String} the new name you want to assign to the set. |
| tag | {String} the new tag you want to assign the set. |
| success | {function} callback function called after success with the return object as a parameter. (optional) |
| failure | {function} callback function called after failure with the return object as a parameter. (optional) |
{Number} The number of rows affected.
services.deleteCustomPlaceSet = function( inputs )
Delete custom place set for a given id.
| inputs | {Object} |
| id | {Number} the existing custom place set id. |
| success | {function} callback function called after success with the return object as a parameter. (optional) |
| failure | {function} callback function called after failure with the return object as a parameter. (optional) |
{Number} The number of rows affected.
services.deleteCustomPlace = function( inputs )
Delete custom place. User needs to supply the set ID and the place ID and it will delete only place IDs in that set, otherwise error.
| inputs | {Object} |
| setId | {Number} ID of set that the custom place is in. |
| placeId | {Number} ID of the custom place. |
| success | {function} callback function called after success with the return object as a parameter. (optional) |
| failure | {function} callback function called after failure with the return object as a parameter. (optional) |
{Number} The number of rows affected.
services.getCustomCategories = function( inputs )
Get custom categories.
| inputs | {Object} |
| id | {Number} Category ID number. (optional) |
| tag | {String} Category tag of one or more categories. (optional) |
| name | {String} Category name of one or more categories. (optional) |
| success | {function} callback function called after success with the return object as a parameter. (optional) |
| failure | {function} callback function called after failure with the return object as a parameter. (optional) |
[{ “Id”: number, “Name”: string, “Icon”: string, “IconURL”: string, “Tag”: string }]
services.addCustomCategory = function( inputs )
Add custom category.
| inputs | {Object} |
| categoryToAdd | {Object} |
| name | {String} name of category. |
| icon | {String} name of category icon. |
| iconURL | {String} image URL of category icon. |
| tag | {String} category tag. |
| success | {function} callback function called after success with the return object as a parameter. (optional) |
| failure | {function} callback function called after failure with the return object as a parameter. (optional) |
| {Number} | category id. |
services.updateCustomCategory = function( inputs )
Update custom categories.
| inputs | {Object} |
| categoryToUpdate | {Object} Array of custom categories. |
| id | {Number} Category ID. |
| name | {String} Category name. |
| icon | {String} Optional new icon name, but if no value is specified the field will be set to null. (optional) |
| inconURL | {String} Optional new icon image URL, but if no value is specified the field will be set to null. (optional) |
| tag | {String} Optional new category tag, but if no value is specified the field will be set to null. (optional) |
| success | {function} callback function called after success with the return object as a parameter. (optional) |
| failure | {function} callback function called after failure with the return object as a parameter. (optional) |
| {Number} | The number of rows affected. |
services.getReports = function ( params )
Takes coords objects and report options, return total time and total distance synchronously. Todo
| inputs | {Object} Todo |
| coords | {Array of decimal pairs} Coordinates of the start, end, and any waypoints for the given route. |
| options | {Object} optional function specification settings. |
| reportOptions | {Object} optional reporting specification settings. |
| vehicleType | {Number} Restricts the route to roads that are accessible by the selected vehicle. Default: 0 (0 - Truck, 1 - Light Truck, 2 - Automobile) |
| routingType | {Number} Generates the route to match the type. Default: 0 (0 - Practical, 1 - Shortest) |
| highwayOnly | {Boolean} Restricts the route to only highway roads. Default: false |
| custRdSpeeds | {Boolean} Can be true or false and indicates whether to use custom road speeds. |
| useAvoidFavors | {Boolean} Can be true or false and indicates whether or not to use avoids and favors while routing. |
| classOverrides | {Number} 0 - Indicates that no class overrides are present, 1 - Indicates a 53’ class override, 2 - Indicates a National Network class override. Default: 0 |
| distanceUnits | {Number} Distance units as miles or kilometers. Default: 0 (0 - Miles, 1 - Kilometers) |
| fuelUnits | {Number} Fuel units as gallons and liters. Default: 0 (0 - Gallons, 1 - Liters) //Why is ‘liters’ being spelled ‘litters’!!! |
| tollDiscourage | {Boolean} Generates the route by trying to avoid toll roads. Default: false |
| inclFerryDist | {Boolean} Indicates whether or not to include ferry distances in mileage calculations; can be true or false. |
| bordersOpen | {Boolean} Indicates whether borders are open for travel. Default: true |
| overrideRestrict | {Boolean} Indicates whether or not to override truck restrictions. Default: false |
| hazMatType | {Number} Restricts the route to roads that allow transportation of the selected hazardous material. Default: 0 (0 - None, 1 - General, 2 - Caustic, 3 - Explosives, 4 - Flammable, 5 - Inhalants, 6 - Radioactive) |
| routeOptimization | {Number} 0 - None, 1 - Optimize All Stops, 2 - Optimize Intermediate Stops. Default: 0 |
| lang | {String} The language. (ENUS - English United States, ENGB - English Great Britain, DE - German, FR - French, ES - Spanish, IT - Italian) |
| hubRouting | {Boolean} Indicates whether or not to enable hub routing; can be true or false. |
| trkUnits | {Number} Vehicle dimension units; can be English or Metric. Default: 0 (0 - Indicates that vehicle dimension units should be English, 1 - Indicates that vehicle dimension units should be metric) |
| trkHeight | {Number} The height of the vehicle in feet and inches or meters depending on units. |
| trkLength | {Number} The length of the vehicle in feet and inches or meters depending on units. |
| trkWidth | {Number} The width of the vehicle in feet and inches or meters depending on units. |
| trkWeight | {Number} The weight of the vehicle in pounds or kilograms depending on units. |
| trkAxles | {Number} The number of axles on the vehicle; acceptable values are 2 through 14. Default: 5 |
| truckConfig | {Number} The vehicle style. Default: 0 (0 - no vehicle style is chosen, 1 - 28’ double trailer, 2 - 40’ straight trailer, 3 - 48’ semitrailer, 4 - 53’ semitrailer) |
| trkLCV | {Boolean} Indicates whether the truck is a multi-trailer or longer combination vehicle. |
| inclTollData | {Boolean} Indicates whether or not reports should calculate toll costs. Default: true |
| fuelEconLoad | {Number} The fuel efficiency (distance units per fuel units) when loaded. |
| fuelEconEmpty | {Number} The fuel efficiency (distance units per fuel units) when empty. |
| costPerFuelUnit | {Number} The cost per fuel unit of fuel. |
| costGHG | {Number} The cost of greenhouse gas in lbs. per fuel unit. |
| costMaintLoad | {Number} The maintenance cost per distance unit when loaded. |
| costMaintEmpty | {Number} The maintenance cost per distance unit when empty. |
| costTimeLoad | {Number} The time cost per mile/km when loaded. |
| costTimeEmpty | {Number} The time cost per mile/km when empty. |
| tollCurrency | {Number} The toll currency. Default: 0 (0 - United States dollars, 1 - Canadian dollars) |
| exchangeRate | {Number} The change rate to convert US dollars to Canadian dollars. |
| tollPlan | The toll discount plan which is a comma-separated list of toll discount programs. Use All for everything otherwise valid values are (407ETR Transponder,A25 Transponder,BreezeBy,C-Pass,Cruise Card,E-Pass,E-Pass Canada,EXpress Toll,EZ Tag,EZPass,EZPass-NJ,EZPass-WV,FAST LANE,FasTrak,GeauxPass,Good To Go,GO-PASS,I-Pass,I-Zoom,K-TAG,Laredo Trade Tag,LeeWay,MACPASS,NC Quick Pass,NEXPress,Palmetto Pass,Peach Pass,PikePass,Quickpass,Smart Tag,StraitPASS,SunPass,TollTag,TxTag,Wabash Pass) |
| citeInt | {Number} The cite interval to be used when generating a geotunnel report. The minimum value is 0.1. |
| region | {String} The data region in which the route stops are located. Default: NA (NA - North America, EU - Europe, OC, SA - South America) |
| type | {String} Comma-separated list of requested report types. (Mileage, Directions, Detail, State, CalcMiles, LeastCost, Geotunnel) |
| format | {String} The format of the report returned with the route. Default: json (json, html) dataVersion {String} Data version. (‘current’,’PCM18’ through ‘PCM26’) |
ALKMaps.Services.getReports({
coords: [[-75.173297,39.942892],[-74.438942,39.362469]],
options: {
vehicleType: 2,
routingType: 0,
routeOptimization: 1,
highwayOnly: false,
distanceUnits: 0,
tollCurrency: 0,
inclTollData:true,
region: "NA"
},
reportOptions: {
type: "Directions,Mileage",
format: "json",
dataVersion: "current"
},
success: function(resp){Display Reports}
});
services.addAvoidFavorSet = function( params )
Add a new avoid/favor set.
{ ‘name’:’Unit tests’, // Description of the set ‘tag’:’unitTests’}, // Additional information to categorize or group closures in a set ‘async’: true, ‘success’: function(resp){ }, ‘failure’: function(resp){ } };
| {Number} | set Id. |
services.getAvoidFavorSets = function( params )
Retrieves all AvoidFavorSets, one specific set if the setId is specified.
{ ‘setId’: ‘2099’, // -1 to retrieve all. ‘name’: ‘test’, // To retrieve all AvoidFavor associated with the name, this will be ignored if a set id is passed in. ‘tag’: ‘unitTest’, // To retrieve all AvoidFavor associated with the tag, this will be ignored if a set id is passed in. ‘detail’: true, ‘async’: true, ‘success’: function(resp){ }, ‘failure’: function(resp){ } }
[ { “Links”:[ { “AvoidFavorID”:476583, “AvoidFavorType”:1, “Comment”:”unitTest”, “Geometries”:[ [ [-78.011913,40.711918], [-78.005676,40.714624], [-77.999278,40.717677] ], [ [-78.011913,40.711918], [-78.005676,40.714624], [-77.999278,40.717677] ] ] } ], “Name”:”Random 365690”, “SetID”:12914, “Tag”:”unitTests” } ]
services.updateAvoidFavorSet = function( params )
Update name and tag based on set Id. If no record is found, the bad request error with message will be returned.
{ ‘setId’: ‘12916’, // {String} the existing avoid/favor set ID ‘tag’: ‘unitTests’, // {String} the new tag for the avoid/favor set ‘name’: ‘unitTest again’, // {String} the new name for the avoid/favor set ‘success’: function(resp){ }, ‘failure’: function(resp){ } }
{ Number } The number of rows affected.
services.addAvoidFavor = function( params )
Add a new set with closure.
{ ‘setId’: 1, //If a set ID is supplied, the system will try to add closures to the given set. ‘projection’: ‘EPSG:4326’, // Accepted projection code format ‘region’: ‘NA’, // Map region ‘mapBounds’: new ALKMaps.Bounds( // Map viewport box -78.02197265625, // Longitude - the left bounds of the box 40.68802734375, // Latitude - the bottom bounds of the box -77.97802734375, // Longitude - the right bounds 40.73197265625), // Latitude - the top bounds ‘afPoint’: { ‘type’:’c’, // Supply “c” to request a closure. At this time, it does not matter because the system will treat all user input as closure. ‘comment’:’unitTest’, // Description of the closure path ‘point’: // Use this location to generate closure path new ALKMaps.LonLat(-78.000183105469, 40.71745844841)}, ‘async’: true, ‘success’: function(resp){ }, ‘failure’: function(resp){ } };
[ { “AvoidFavorID”:476583, “AvoidFavorType”:1, “Comment”:”unitTest”, “Geometries”:[ [ [-78.011913,40.711918], [-78.005676,40.714624], [-77.999278,40.717677] ], [ [-78.011913,40.711918], [-78.005676,40.714624], [-77.999278,40.717677] ] ] } ]
Get custom places for a given account.
services.getCustomPlaces = function ( inputs )
Update custom place set’s name, and tag for a given set id and tag.
services.updateCustomPlaceSet = function( inputs )
Delete custom place set for a given id.
services.deleteCustomPlaceSet = function( inputs )
Delete custom place.
services.deleteCustomPlace = function( inputs )
Get custom categories.
services.getCustomCategories = function( inputs )
Add custom category.
services.addCustomCategory = function( inputs )
Update custom categories.
services.updateCustomCategory = function( inputs )
Takes coords objects and report options, return total time and total distance synchronously.
services.getReports = function ( params )
Takes coords objects and route options, return lat/lons for the route path.
services.getRoutePath = function ( params )
Add a new avoid/favor set.
services.addAvoidFavorSet = function( params )
Retrieves all AvoidFavorSets, one specific set if the setId is specified.
services.getAvoidFavorSets = function( params )
Update name and tag based on set Id.
services.updateAvoidFavorSet = function( params )
Deletes the AvoidFavor set.
services.deleteAvoidFavorSet = function( params )
Add a new set with closure.
services.addAvoidFavor = function( params )
Deletes a specific AvoidFavors within a set.
services.deleteAvoidFavor = function( params )