VIAMICHELIN JAVASCRIPT API


Quickstart

The first thing you need to do for getting start with the POIs (points of interest) component, is to create an API key and a data base id. You must store your data in Michelin database or use MICHELIN database such as MICHELIN Restaurant, MICHELIN Hotels and Michelin Travel.

Find Poi, allows you to find out the closest static POIs from a specific location (GPS center - WGS84 coordinates) and returns a POI list sorted in ascending distance. 

To include ViaMichelin API in your website, you need to add the following authentication tag to your HTML file: 

<script src="http://apijsv2.viamichelin.com/apijsv2/api/js?key=KEY&lang=LANG" type="text/javascript"></script>

 

For more details about Key and LANG, please refer to the loading of APIJS.

Use Find POI

In this example, we are going to find out POIs (Points of interest) from MICHELIN database around Paris (result in French and output in xml).

HTML

You need to create a HTML tag, which is going to be used as container to display POIs list. 

<pre id="output"></pre>

JavaScript configuration

To be able to launch a proximity search, you must provide the geo-coordinates center and the data base id. 

In the configuration below, the data base id: 163978 is provided by MICHELIN and gives access to MICHELIN Guide databases. This identifier is not the same for the other keys.

 
     
  	var conf = {
            db : "163978",
            service : ViaMichelin.Api.Constants.Poi.SERVICE_TYPE.FIND_POI,
            center : {
              // Paris 
              lon : 2.35107,
              lat : 48.85684 
            } 
          };
  
    

Find Poi Result – Callback function

The response will be passed in the function called onSuccess. This function will trigger once the search done. The returned result contains a property poiList, which is a JSON Array. 

 

Launch the research

To launch proximity search, you'll need to call the method VMLaunch, with the following parameters:  “ViaMichelin.Api.Poi” component, conf and callbacks

 

Demonstration

Please have a look at the following demonstration page

Go Further with Find POI

Select a demo to discover what happens, for more technical details, consult the reference section.