Oracle Maps example - multiple basemap layers

  • Show Demo_Map
  • Show Customer_Map

Instructions

This demo shows that you can add multiple basemap layers to the map area. A base map is typically associated with a MapViewer basemap and all of its map tiles are pre-generated and cached by a map cache instance. In this case two basemaps from the mvdemo schema are added to the map display, and you can switch the visibility of each.

Note that in order to display the customer basemap, you must have created a map cache instance using MapViewer's Admin web page for the 'CUSTOMER_MAP' base map. You can follow similar instructions for 'DEMO_MAP' in the tutorial setup page.

Source code

  var mapview;
  
  var basemap1 = new MVMapTileLayer("mvdemo.demo_map");
  var basemap2 = new MVMapTileLayer("mvdemo.customer_map", "",  true);
  basemap2.setTransparent(true);
  
  function showMap() 
  {	
    var baseURL  = "http://"+document.location.host+"/mapviewer";
    var mapCenterLon = -122.45;
    var mapCenterLat =  37.6706;
    var mapZoom      =  4; 
    var mpoint = MVSdoGeometry.createPoint(mapCenterLon,mapCenterLat,8307);
    mapview = new MVMapView(document.getElementById("map"), baseURL);

      
    mapview.addMapTileLayer(basemap1);  
    mapview.addMapTileLayer(basemap2); 
    basemap1.setVisible (true);
    basemap2.setVisible (true);
  
    mapview.setCenter(mpoint);   
    mapview.setZoomLevel(mapZoom);    
    mapview.display();
  }
  
  function setVisible(item)
  {
      
    var basemap = eval(item.value);
    basemap.setVisible(!basemap.isVisible());
    
  }