VIAMICHELIN JAVASCRIPT API


Reference

The itinerary component is called ViaMichelin.Api.Itinerary. It works with the VMLaunch method, and 2 parameters : conf and callbacks.

conf : configuration of the component

callbacks : event listeners of the component

 

VMLaunch("ViaMichelin.Api.Itinerary", conf, callbacks);

 

Configuration

Common Configuration

(array) steps

This parameter is required.

It allows to specify the different steps of the itinerary. The first stage is the starting point and the last stage is the arrival. So, you have to provide at least 2 places.

The further stages (if more than 2), represent places through which the itinerary must pass.

 

Each step is represented by an object which can be defined in several ways :

 

{locId : string}

Contains a « locId ». Check the reference of geocoding.

{coords : {lon : number, lat : number}}

Contains geographic coordinates,  latitude and  longitude.

{poi : {db : number, id : number}}

Contains l informations which allow to identify a POI in the base.

{address : GeocodingConfig}

Contains a configuration of geocoding necessary to determine the place of the step.

A geocoding is carried out for each step, defined like this way.

(object) map

It allows to display the path on the map. See more details below.

(HTML Element) map.container

It allows to display the path on the map, when the container is specified.

 

(boolean) map.focus

It indicates if the map has to be redrawn by adjusting itself to the limits of all the graphic objects of the route.

 

(HTMLElement) roadsheet

It allows to display the road map in a DOM element specified.

 

(number) veht

It allows to specify the mean of transport used for the itinerary.

The different possible values are the following :

ViaMichelin.Api.Constants.Itinerary.VEHICULE_TYPE.

CAR

Car

TRUCK

Truck

ON_FOOT

Pedestrian

CYCLE

Cycle

MOTO

Moto

 

By default,  the value is ViaMichelin.Api.Constants.Itinerary.VEHICULE_TYPE.CAR.

 

(number) itit

Type of route which must be calculated.

The different possible values are the following constants:

ViaMichelin.Api.Constants.Itinerary.ITINERARY_TYPE.

RECOMMENDED

Recommanded by Michelin

QUICK

The faster

SHORT

The shorter

DISCOVERY

The discovery route

ECONOMIC

The cheaper


Par défaut la valeur est ViaMichelin.Api.Constants.Itinerary.ITINERARY_TYPE.RECOMMENDED.

(boolean) favMotorways

It indicates if the route must prioritize the highways.

By default : false.

 

(boolean) avoidBorders

It indicates if the route has to avoid or not, Indique si l'itinéraire doit éviter ou non the border crossings.

By default : false.

 

(boolean) avoidTolls

It indicates if the route has to avoid or not the Indique si l'itinéraire doit éviter ou non the road tolls.

By default : false.

 

(boolean) avoidCCZ

It indicates if the route must avoid or not the areas not free of charge (Congestion Charge Zone). 

By default : false.

 

(boolean) avoidORC

If the route has to avoid or not, the non-road areas, like ferrys or the piggyback transport  (Off-Road Connections). 

By default : false.

 

(boolean) multipleIti

It specifies  if  you want to obtain the alternative routes if they exist. All summaries of the routes are available in the section header of the response object.

By default : false.

 

(number) itiIdx

Index of the itinerary from which you want to get the datas. It makes sense only if the parameter «multipleIti» is set to true.

 

(string) distUnit

The distance unit used to for the result.

The different possible values are the following constants:

 

ViaMichelin.Api.Constants.Itinerary.DIST_UNIT.

METERS

Distances in meters.

MILES

Distances in miles.

By default the value is ViaMichelin.Api.Constants.Itinerary.DIST_UNIT.METERS.

(object) fuelConsump

It contains  the average consumption of the vehicle in liters for 100km to 50km/h, 90km/h and 120km/h.

By default, the value is {city:7.9, road:6.9, hwy:7}

 

(number) fuelConsump.city

Contains the average consumption of the vehicle in liters for 100km, until 50km/h..  

 

By default, the value is 7.9

 

(number) fuelConsump.road

Contains the average consumption of the vehicle in liters for 100km, until 90km/h.. 

By default, the value is 6.9

 

(number) fuelConsump.hwy

Contains the average consumption of the vehicle in liters for 100km, until 120km/h.. 

By default, the value is 7

 

(number) fuelCost

Cost of the fuel (le choix de la monnaie est implicite). 

By default, the value is 1.3

 

(object) traffic

Specifies if the calculation takes into account the traffic impact  on one or several countries. 
It is disabled by default.

(array) traffic.country

It allows to specify the countries concerned with the impact traffic. 

It is a list of code ISO country 3 letters. Example: ['FRA', 'GBR'] 
If all the countries must be taken into account, the list will be ['ALL'].

 

(boolean) wCaravan

Specifies if calculation must take into account the presence of a caravan, that will affect the cost of toll. 

By default, the value is false.

 

(boolean) withSecurityAdv

Specifies if the calculation must take into account informations about security. 

By default, the value is false.

 

(string) date

Starting date of the route. That makes it possible to take account of the opening or closing of roads (collars, etc). 
The date must be written in the form aaaa-mm-jj. 

By default, the current date is used.

 

(string) currency

currency used to get the toll costs.

currency can take the following values:

ViaMichelin.Api.Constants.Itinerary.CURRENCY.

EUR

Euro

CHF

Swiss franc 

CZK

Czech koruna

DKK

Danish krone

GBP

British pound sterling

HRK

Croatian kuna

HUF

Hungarian forint

NOK

Norwegian krone

PLN

Polish zloty

SEK

Swedish krona

SIT

Slovenian tolar

SKK

Slovak koruna

UAH

Ukrainian hryvnia

USD

American dollar 

By default, the value is ViaMichelin.Api.Constants.Itinerary.CURRENCY.EUR.

 

(boolean) distanceByCountry

It allows to have the calculation of the distance by country in addition to the total distance.

By default, the value is false.

 

The specific configuration for trucks

 

(object) truckOpts

Trucks options.

 

(number) truckOpts.axels

Quantity of axles (6, 8, ...)

 

(number) truckOpts.width

Width in decimeters.

 

(number) truckOpts.height

Width in decimeters.

 

(number) truckOpts.weight

Weight in quintal (tenth of ton).

 

(number) truckOpts.category

 

  • 0: any category of vehicle
  • 4: public transport
  • 5: carriage of goods
  • 6: transport of explosive products
  • 7: transport of polluting product
  • 8: transport of hazardous substances


(number) truckOpts.euro

European StandardNorme of emission.

 

Poi's configuration

 

(object) pois

A complementary parameter setting to launch a search for Poi along the route. 
If the parameter map is prioritized, the Pois are displayed automatically on the map. 
The event onSuccess will transmit 2 values, the first will be the response of the calculation of route, the second will be the list of the poi's found.

 

(string) pois.db

Single ID from the database (provided by ViaMichelin).

 

(number) pois.dist

Maximum distance in meters of the route representing the area of Pois search (the radius around...). 
It must be ranging between 0 and 200,000.

By default, the value is 10.000.

 

(number) pois.nb

Maximum number of Pois to display along the route 

It must be ranging between 1 and 100.

By default, the value is 20.

 

(string) pois.dir

 

Direction in which the research must be carried out. 
The parameter can take the following values:

ViaMichelin.Api.Constants.Poi.DIRECTION.

TO

Only the POIs in the direction of the route will be displayed. To go towards one of it won't get you back to your steps.

FROM

All the POIs corresponding to the search will be displayed, even if it makes you step back. 

By default, the value is : ViaMichelin.Api.Constants.Poi.DIRECTION.TO.

(number) pois.time

The maximal time to reach the POI from the route in seconds (values between 60 to 7200).

 

(array) pois.criteria

Criteria of restriction of the search on the values of the digital metadatas. 
Each entry is an object in the form {id: number, been worth: number}.

 

Events

Listeners can be used for events below.

Les paramètres associés aux événements sont ceux reçus par l'écouteur.

onInit

Triggered when the geocoding component is correctly loaded.

Parameters

  • component : reference of the component

onInitError

      Triggered when the error occurred during the loading of the geocoding component.

Parameters

  • component : reference of the component
  • error : the error occured

onSuccess

     Triggered during the geocoding search service.

Paramètres

  • result : le résultat de la recherche de POIs

onError

     Triggered during the response of the geocoding service, when an error is returned.

Parameters

  • error : the error occured