为什么发布的kml,加载不出来?
代码如下:我的错误出在哪里了?这个源代码里,我修改了kml的地址,别的没有做改动?
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DT ... gt%3B
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no">
<title>KMLLayer - 4.6</title>
<style>
html,
body,
#viewDiv {
padding: 0;
margin: 0;
height: 100%;
width: 100%;
}
</style>
<link rel="stylesheet" href="https://js.arcgis.com/4.6/esri ... gt%3B
<script src="https://js.arcgis.com/4.6/%26q ... gt%3B
<script>
require([
"esri/Map",
"esri/views/MapView",
"esri/layers/KMLLayer",
"esri/widgets/ScaleBar",
"dojo/domReady!"
], function (
Map,
MapView,
KMLLayer,
ScaleBar
) {
var layer = new KMLLayer({
url: "http://localhost:6080/arcgis/r ... ot%3B // lane closures from California Dept of Transportation
});
var map = new Map({
basemap: "topo",
layers: [layer]
});
var view = new MapView({
container: "viewDiv",
map: map,
center: [-120, 38],
zoom: 6
});
var scalebar = new ScaleBar({
view: view
});
view.ui.add(scalebar, "bottom-left");
});
</script>
</head>
<body></body>
</html>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DT ... gt%3B
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no">
<title>KMLLayer - 4.6</title>
<style>
html,
body,
#viewDiv {
padding: 0;
margin: 0;
height: 100%;
width: 100%;
}
</style>
<link rel="stylesheet" href="https://js.arcgis.com/4.6/esri ... gt%3B
<script src="https://js.arcgis.com/4.6/%26q ... gt%3B
<script>
require([
"esri/Map",
"esri/views/MapView",
"esri/layers/KMLLayer",
"esri/widgets/ScaleBar",
"dojo/domReady!"
], function (
Map,
MapView,
KMLLayer,
ScaleBar
) {
var layer = new KMLLayer({
url: "http://localhost:6080/arcgis/r ... ot%3B // lane closures from California Dept of Transportation
});
var map = new Map({
basemap: "topo",
layers: [layer]
});
var view = new MapView({
container: "viewDiv",
map: map,
center: [-120, 38],
zoom: 6
});
var scalebar = new ScaleBar({
view: view
});
view.ui.add(scalebar, "bottom-left");
});
</script>
</head>
<body></body>
</html>
2 个回复
许丹石
赞同来自:
烟雨青春98 - Mia
赞同来自:
然后又按照您的回复,将localhost改为了ip地址,还是加载不出来,是我这个改动不对吗?
要回复问题请先登录或注册
发起人
Mia
相关问题
问题状态