Oracle Maps example - Display a map


Instructios

Try dragging the above map around.

Source code

The JavaScript source code for the above map display is listed below.
  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);
    var mapview = new MVMapView(document.getElementById("map"), baseURL);
    mapview.addMapTileLayer(new MVMapTileLayer("mvdemo.demo_map")); 
    mapview.setCenter(mpoint); 
    mapview.setZoomLevel(mapZoom);    
    mapview.display();  			
  }    
    
The map is displayed inside a container DIV element such as the following:
    <div id="map" style="left:0px; top:0px; width:100%; height:60%"></div>
  
Note that the id of the DIV element, "map", is passed into the constructor of the MVMapView object in the JavaScript code above. This establishes the link between the DIV element and the JavaScript mapping client.