VIAMICHELIN JAVASCRIPT API


Reference

The geocoding component is called ViaMichelin.Api.Geocoding. It works with VMLaunch method and two parameters conf and callbacks.

conf : configuration of the component

callbacks : listenres events of the component

 

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

Configuration

1 field

(string) singleFieldSearch 

                    This parameter allows you to specify a full address (street+zipcode+town) in the input search for the geocoding.

(string) favoriteCountry

                This parameter is used for prioritize a country on the search. Its value has to be an ISO code with 3 letters.

3 fields

(string) address

                It permits you to specify an address (street, village...) for search field for the geocoding.

(string) cityZip

                It is used for specify the city with a zipcode for a search field for geoding.

(string) countryISOCode

                It is used for specify a country for a search field for geoding.

4 fields

(string) address

                It is used for specify an adress (street, village,..) for a search field for geoding.

(string) city

                It is used for specify the city for a search field for geocoding.

(string) zip

                It is used for specify the zipcode for a search field for geocoding.

(string) countryISOCode

                It is used for specify the country for a search field for geocoding.

By location ID

(string) id

              This parameter enables you to launch a request from an geolocation id provided by ViaMichelin.

Inverse

(object) coords

                It is used for specify the geographic coordinates on the request (input) for geocoding. It is an object with 2 properties lon and lat, respectively longitude and latitude.

(number) coords.lon

                It is used for specify the longitude of a place for geocoding.

(number) coords.lat

                It is used for specify the latitude of a place for geocoding.

Events

Listeners can be used for events below.

 

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.

Parameters

  • results : the results of the geocoding request

onError

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

Then, onError is triggered instead of onSucess event. If any correspondence have been found, without errors, the event onSuccess is trigerred with an empty array on the parameter.

 

Parameters

  • response : the service response which contains the error