其他分享
首页 > 其他分享> > KMLLayer

KMLLayer

作者:互联网

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title></title>
    <link rel="stylesheet" href="http://js.arcgis.com/3.9/js/esri/css/esri.css">
    <style>
        html, body, #map {
            padding:0;
            margin:0;
            height:100%;
            width:100%;
        }
    </style>
    <script src="http://js.arcgis.com/3.9/"></script>
    <script type="text/javascript">
        var map;

        require([
        "esri/map",
        "esri/layers/ArcGISTiledMapServiceLayer",
        "esri/layers/KMLLayer",
        "dojo/domReady!"
        ], function (
        Map, ArcGISTiledMapServiceLayer, KMLLayer
        ) {
            var agoServiceURL = "http://server.arcgisonline.com/arcgis/rest/services/ESRI_StreetMap_World_2D/MapServer";
            var agoLayer = new ArcGISTiledMapServiceLayer(agoServiceURL);
            map = new Map("map", {
                center: [-122.393, 40.593],
                zoom: 12
            });
            map.addLayer(agoLayer);

            var kmlUrl = "http://www.ci.redding.ca.us/KML/SacRiverTrail.kml";
            var kml = new KMLLayer(kmlUrl);
            map.addLayer(kml);
        });
    </script>
</head>
<body class="tundra">
    <div id="map">
    </div>
</body>
</html>

 

标签:map,kml,KMLLayer,var,new,esri
来源: https://www.cnblogs.com/Jeely/p/11174798.html