[英]ArcGIS JavaScript API Error - “Unable to Load File”
当尝试为我的代码提供一个webmap id以及用于ArcGIS Online Web Map的ESRI教程时,我始终遇到以下错误:
以下是我当前正在使用的Javascript代码。
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Create a Web Map</title>
<link rel="stylesheet" type="text/css"
href="http://js.arcgis.com/3.9/js/esri/css/esri.css" />
<style>
html, body, #mapDiv,.map.container{
padding:0;
margin:0;
height:100%;
}
#legendDiv{
background-color: #fff;
postion: absolute !important;
z-index: 99;
top:10px;
right:20px;
}
</style>
<script>var dojoConfig = { parseOnLoad:true };</script>
<script src="http://js.arcgis.com/3.9compact/"></script>
<script>
var map;
require([
"esri/map",
"esri/arcgis/utils",
"esri/dijit/Legend",
"dojo/domReady!"
], function(Map, arcgisUtils, Legend){
arcgisUtils.createMap("08fdfee37898470385ad4b3752db969f", "mapDiv").then(function
(response) {
map = response.map;
var legend = new Legend({
map: map,
layerInfos:(arcgisUtils.getLegendLayers(response))
}, "legendDiv");
legend.startup();
});
});
</script>
</head>
<body>
<div id="mapDiv"></div>
<div id="legendDiv"></div>
</body>
</html>
该地图ID是弗吉尼亚州里士满市历史遗址的公开地图
相同的代码在我的浏览器中运行正常,没有任何错误。 您身边的互联网速度可能很慢。由于互联网速度慢,您将遇到第二个错误。不确定第一个错误。
我尝试了相同的代码,并且工作正常。
根据您的屏幕截图,您正在尝试从本地系统打开文件。
为了能够成功加载此页面,需要将其部署在Web服务器(IIS,tomcat等)中。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.