jo8

Bing maps

Discussion created by jo8 on Dec 19, 2013
Latest reply on Dec 23, 2013 by JGravois-esristaff
Hi all !! Why not add a layer??

[HTML]
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
    <title>Add an ArcGIS Service</title>
    <script src="http://dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=6.2" type="text/javascript" language="javascript"></script>
    <script src="http://serverapi.arcgisonline.com/jsapi/ve/?v=1.4" type="text/javascript"></script>
    <script language="javascript" type="text/javascript" >
        var map = null;
        var agisve_services = null;
        var tileUrl = "http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Demographics/ESRI_Population_World/MapServer";
       
        function OnPageLoad() {
            // create point to use as map center point
            var centerat = new VELatLong(45.50634690108341, -122.67883300781251);
            // new map instance
            map = new VEMap('mymap');
            var mapOptions = new VEMapOptions();
            mapOptions.EnableBirdseye = false;
            // load map
            map.LoadMap(centerat, 15, VEMapStyle.Aerial, false, VEMapMode.Mode2D, false, 0, mapOptions);
       }
       
        function AddMap() {
            // create a new layer factory
            agisve_services = new ESRI.ArcGIS.VE.ArcGISLayerFactory();
            // create the tile layer specfication using url and response function
            agisve_services.CreateLayer(tileUrl, "Parcels", GetMap);  
                
        }
       
        function GetMap(tileSourceSpec, resourceInfo) {
            // set opacity of tile layer specification
            tileSourceSpec.Opacity = 0.35;
            // add layer to map using the tile layer specification
            map.AddTileLayer(tileSourceSpec,true);
            $get("resultDiv").style.visibility ="hidden";
        }
    </script>
</head>
<body onload="OnPageLoad()" >
     <form action="" >
        <div id='mymap' style="position:absolute; left: 0px; top: 0px; width: 750px; height: 500px;"></div>
        <div id='resultDiv' style="position:absolute; width:200px; height: 50px; left: 540px; top: 10px; font-family: Verdana; font-size: x-small; border: double black; background-color: White; z-index: 10000;">
        <div id="resultHeader" style="width: 100%; text-align: center; height: 50px;">
      Click Add to add a map service<br /><input type="button" value="Add" style="width: 75px;" onclick="AddMap()" /></div>
       
      </div>
     </form>
</body>
</html>
[/HTML]

Outcomes