APIs
Log In
APIs

YoumapsAPI.displayMapdata

YoumapsAPI.displayMapdata(mapdataId:Integer,callback:Function)

Displays the mapdata with the given id on the map.

📘

Prerequisite

The Mapboard instance to which belongs the mapdata must be loaded before you can display it by calling YoumapsAPI.displayMapdata.

function onYoumapsApiLoaded(){
  console.log("YoumapsAPI loaded!");
  // if the mapdata is of type MarkerLayer
  youmapsApi.displayMapdata(<MAPDATA1_ID>, callbackDisplayMapdata);
  // if the mapdata is of type TileLayer
  youmapsApi.displayMapdata(<MAPDATA2_ID>);
}
                            
function callbackDisplayMapdata(markerLayer){
  console.log("Mapdata displayed!");
  // the MarkerLayer instance is returned by the callback
  var markerLayerInstance = markerLayer;
}
  
var mapOptions = {  
  center : new google.maps.LatLng(48.858386, 2.343435), // Paris,
  zoom : 11,
  minZoom : 6,
  maxZoom : 17
};

var youmapsApi = new YoumapsAPI(
  {
    techID : <YOUR_TECH_ID>, 
    initMapboards : true,
    mapDivId : "map",
    mapOptions : mapOptions
  },
  onYoumapsApiLoaded
);