VIAMICHELIN JAVASCRIPT API


Reference

 

Find POIs documentation 

The component in charge of Find POI is named “ViaMichelin.Api.Poi”
To use this component, we first need to call VMLaunch method with two arguments: conf and callbacks. 

  • conf: configuration of the component
  • callbacks: event listener, which is used to retrieve data. 
 
 
     VMLaunch("ViaMichelin.Api.Poi", conf, callbacks);
 

 

(string) db

Unique database identifier to find POIs

Provided by ViaMichelin.
This parameter is required, except for FIND_INPUT_POI and FIND_INPUT_POI_BY_ROAD. 

 

(string) service

Chose the service to use for find POIs.

Most of those services do research on the database specified by the db parameter, but not all have the same behavior.

Possible values : 

ViaMichelin.Api.Constants.Poi.SERVICE_TYPE. + “Concatinate with following contants“

POI

Get POI information

 

FIND_POI

Searches for the closest static POI from a specific location and returns a POIs list sorted in ascending distance.

Calculation is based on as the crow flies and POIs are hosted on a ViaMichelin database).

POIs should be hosted on a ViaMichelin database.

FIND_POI_BY_ROAD

Searches for the closest static POI from a specific location and returns a POIs list sorted in ascending distance.

Calculation is road-based.

POIs should be hosted on a ViaMichelin database.

FIND_POI_NEAR_ROUTE

Searches for static POIs near route from a matching point with itinerary and departure point. Returns a POIs list stored in ascending distance.

Calculation is road-based.

POIs should be hosted on a ViaMichelin database.

FIND_POI_BY_CRITERIA

Searches for static POI using criteria (filter) given as parameters.

Returns a POIs list respecting criteria defined input parameters.
Criteria could be geographic and/or related to POI information (metanum, text).

POIs should be hosted on a ViaMichelin database.

FIND_INPUT_POI

Allows to order by distance the dynamic POIs list given in parameter from a specific location.

 

Calculation is based on as the crow flies.

FIND_INPUT_POI_BY_ROAD

Allows to order by distance the dynamic POIs list given in parameter from a specific location by road.

 

Calculation is road-based.

Default : ViaMichelin.Api.Constants.Poi.SERVICE_TYPE.POI

 

(string) poiid

Unique POI identifier in the database

 

(object) center

Center used to launch a proximity search.

Could be:

 - Geo-coordinates object {coords:{lat : number, lon : number}}

 - Object with address property. Contains geocoding configuration {address : GeocodingConfig}

 

(array) inputpoi

Dynamic POI list (minimum 1, maximum 30). Each element contains name and coordinates, as showed here: [{name:string, {coords{lon:number, lat:number}}]

 

(number) dist

Search radius in metres (from 0 to 200,000).

Default: 10.000

 

(number) time

Time limit to reach POIs by road in seconds (from 60 to 7,200).

 

(number) nb

Number of returned POIs (from 1 to 100).

Default: 20 

 

(string) name

Filter on POIs name. See also textMode parameter.

 

(string) text

Filter on a string (full text search). See also textMode parameter.

 

(string) textMode 

Search mode applied to multi-valued name and text parameters. TEXTMODE may admits the following values:

ViaMichelin.Api.Constants.Poi.TEXT_MODE.

OR

Only POIs contains at least one word are returned.

AND

Only POIs contains all words are returned.

Default : ViaMichelin.Api.Constants.Poi.TEXT_MODE.AND

 

(array) criteria

Filter on the result dataset according to the value of the numeric metadata.

It is represented as an object and should respect the following structure: {id:number, value:number|string}. e.g. to get POIs with metanum 1 set to 2, you write [{id:1:value:2}]

It is possible to make a multivalued criteria using “;”. Ex:  {id:2, value:"5;6"}, means criteria 2 equal to 5 or 6.  

 

(number) sidx 

Allows pagination by specifying index of the first returned POI in the dataset. For example, if sidx=2 and nb=3, answer contains only the sub POI list from the 3rd to the 5th rank.

Default: -1 (no pagination)

 

(string) countryLst

Filter by country (ISO ALPHA-3).

Can be multivalued ( “;” to separate code).  

 

(string) zipLst

Filter by post code.

Can be multivalued ( “;” to separate code). 

 

(number) orderBy

Identifier of the metanum used to sort POIs.

See also orderDir parameter.

 

(orderDir) orderDir

Arranges the order (ascending or descending) for metanum set in orderBy parameter.

Can take one of the following values:

ViaMichelin.Api.Constants.Poi.ORDER_DIR.

ASC

ascending

 

DESC

descending

Default : ViaMichelin.Api.Constants.Poi.ORDER_DIR.ASC

 

(object) geobounds

Filter POIs on geographic boundaries.

 

(object) geobounds.min

Geo-coordinates: {lon:number, lat:number}.

(object) geobounds.max

Geo-coordinates: {lon:number, lat:number}.

 

Map parameters 

(object) map

Object used to display POIs in the map.

(HTMLElement) map.container

DOM element containing the map used to display POIs as Markers.

(boolean) map.focus

Specifies if the map should be redrawn to fit all contained graphics objects (including newly added POIs).

(object) map.offset

Defines the position of the POI list index relative to the top left corner of POI markers.

 

(string) map.iconPath

Defines the URL of marker icons. It must contains the {ICON_ID} sub-string that is automatically replaced with the suitable value for each marker. If not set, API tries to use the Client Data stored at ViaMichelin.

 
map: {
    container: $_id("dMapContainer"),
    focus: true,
    offset: { x: 30,	y: 0},
    iconPath: "img/mapiconpoi{ICON_ID}.png"
}

 

Route planner parameters

These settings are used only with the service: ViaMichelin.Api.Constants.Poi.SERVICE_TYPE.FIND_POI_NEAR_ROUTE

These settings are the same as those you can find in the routing component. For more information, please see itinerary documentation.

 

(array) steps

List of steps (8 maximum, including departure and arrival). If addresses are entered, geocoding operations are performed.

Possible formats: 

{locId:string}

Use a specific ViaMichelin location id (got in the geocoding).

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

Use geo coordinates of place.

{poi:string}

Use a POI identifier

{address: {GeocodingConfig}}

Use geocoding settings to identify the place.

 

(string) veht

Allows to specify vehicle type to use for a route calculation.

Possible values:

ViaMichelin.Api.Constants.Itinerary.VEHICULE_TYPE.

CAR

Car

 

TRUCK

Truck

 

ON_FOOT

Walke

 

CYCLE

Bicycle

 

MOTO

Moto

Default value: ViaMichelin.Api.Constants.Itinerary.VEHICULE_TYPE.CAR

(number) itit

Type of itinerary to be calculated.

Possible values:

Prefix = ViaMichelin.Api.Constants.Itinerary.ITINERARY_TYPE.

Prefix

RECOMMENDED

Focuses on road safety and comfort while offering a good compromise between time and distance.

 

QUICK

Provides the fastest route by focusing on motorways and major roads.

 

SHORT

The shortest distance

 

DISCOVERY

focuses on scenic roads that may have some interest in terms of tourism.

 

ECONOMIC

Takes into consideration fuel consumption costs and tolls as well as the route distance

Default : ViaMichelin.Api.Constants.Itinerary.ITINERARY_TYPE.RECOMMENDED

 

(string) dir

Direction in which the search should be performed.

Possible values:

ViaMichelin.Api.Constants.Itinerary.DIRECTION.

[prefix].

TO

Only the POIs in the direction of the route will be displayed.

 

FROM

All POIs corresponding to the search will be displayed, even if it did go back.

Default: ViaMichelin.Api.Constants.Itinerary.DIRECTION.TO

The following parameters of the route are also available for searching POIs:

  • favMotorways
  • avoidBorders
  • avoidCCZ
  • avoidORC
  • avoidTolls

For more details, please have a look at Itinerary section

 

Events 

Listeners can be created for the events below.
Parameters associated with those events are received by the listener.

 

onInit

Triggered when the routing component is loaded correctly.

Parameters

  • component : component reference

onInitError

Triggered when an error occurs during the loading component.

Parameters

  • component : component reference
  • error : occurred error

onSuccess

Triggered when the calculation was successfully done.

Parameters

  • result : Find POIs result

onError

Triggered when an error occurs during routing.

Parameters

  • error : occurred error