VIAMICHELIN JAVASCRIPT API


Common service objects

 

VMLaunch function

All service objects in ViaMichelin JavaScript API v2 are initiated via the VMLaunch function.

FunctionDescription
VMLaunch(serviceName:string, serviceConfig: object, serviceCallbacks: object) launches the requested service by instantiating the related object.

 

Parameters

ParameterTypeDescription
serviceName string Name of the service to launch. List available below.
serviceConfig object Configuration object related to launched service. See documentation sections.
serviceCallbacks object Callback object. Common callbacks are
onSuccess(obj:serviceObject), triggered after normal execution.
onError(response:Error), triggered in the event of an error.
onInitError(obj), triggered in the event of a failed service activation.
onInit(obj:serviceObject), triggered after activation to retrieve the service object for future manipulation (useful withViaMichelin.Api.Map).

 

Common methods to service objects

FunctionDescription
addEventListener(eventName:string, method:function, thisObj:object) Add an event listener to an object.
removeEventListener(eventName:string, method:function, thisObj:object) Remove an event listener from an object.
removeEventListeners() Remove all event listeners from an object.

 

Error Class

PropertyTypeDescription
errorCode ERRORCODE Error code. ERRORCODE has one of the following values:
ViaMichelin.Api.Constants.Exception.BAD_REQUEST
...ACCESS_DENIED
...SERVICE_ACCESS_DENIED
...INVALID_PARAMETER
...ABNORMAL_SERVICE_TERMINATION
...REQUIRED_PARAMETER
errorMsg string Explicit error message.

 

API common objects

 

GeoPoint

PropertyTypeDescription
lon float WGS84 longitude in decimal degrees (from -180.0 to +180.0)
lat float WGS84 latitude in decimal degrees (from -90.0 to +90.0)

 

Point

PropertyTypeDescription
x int Horizontal coordinate in pixels (axis from left to right)
y int Vertical coordinate in pixels (axis from top to bottom)

 

POIId

PropertyTypeDescription
db int Unique database identifier (provided by ViaMichelin).
id int Unique POI identifier in the database.

 

Size

PropertyTypeDescription
width int Width in context units (commonly in pixels)
height int Height in context units (commonly in pixels)

 

Back to top