Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/search/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Dojo ArcGIS-WebMap创建错误_Dojo_Arcgis - Fatal编程技术网

Dojo ArcGIS-WebMap创建错误

Dojo ArcGIS-WebMap创建错误,dojo,arcgis,Dojo,Arcgis,我创建了一个精确的示例,并尝试运行它。我犯了很多错误。有人能告诉我怎么解决这个问题吗 以下是其中一个错误: NS_ERROR_DOM_BAD_URI: Access to restricted URI denied { response={...}, xhr=XMLHttpRequest, code=1012, mor 我还包括以下全部工作代码: <!DOCTYPE html> <html> <head> <title>Create

我创建了一个精确的示例,并尝试运行它。我犯了很多错误。有人能告诉我怎么解决这个问题吗

以下是其中一个错误:

NS_ERROR_DOM_BAD_URI: Access to restricted URI denied { response={...}, xhr=XMLHttpRequest, code=1012, mor
我还包括以下全部工作代码:

<!DOCTYPE html>
  <html>
  <head>
  <title>Create a Web Map</title>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  <meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no">

  <link rel="stylesheet" type="text/css" href="http://js.arcgis.com/3.11/esri/css/esri.css">
  <style>
    html,body,#mapDiv,.map.container{
      padding:0;
      margin:0;
      height:100%;
    }
    #legendDiv{
      background-color: #fff;
      position: absolute !important;
      z-index: 99;
      top:10px;
      right:20px;
    }
  </style>

  <script>var dojoConfig = { parseOnLoad: true };</script>
  <script src="http://js.arcgis.com/3.11compact/"></script>
  <script>
    var map,
        webmapId = "1a40fa5cc1ab4569b79f45444d728067";

    require([
      "esri/map",
      "esri/arcgis/utils",
      "esri/dijit/Legend",
      "dojo/domReady!"
      ], function (Map, arcgisUtils, Legend) {
        arcgisUtils.createMap(webmapId, "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>

创建网络地图
html,body,#mapDiv,.map.container{
填充:0;
保证金:0;
身高:100%;
}
#传奇人物{
背景色:#fff;
位置:绝对!重要;
z指数:99;
顶部:10px;
右:20px;
}
var dojoConfig={parseOnLoad:true};
var映射,
webmapId=“1A40FA5CC1AB4569B79F4544D728067”;
要求([
“esri/map”,
“esri/arcgis/utils”,
“esri/dijit/Legend”,
“dojo/domReady!”
],功能(地图、arcgisUtils、图例){
createMap(webmapId,“mapDiv”)。然后(函数(响应){
map=response.map;
变量图例=新图例({
地图:地图,
layerInfos:(arcgisUtils.getLegendLayers(响应))
}“legendDiv”);
legend.startup();
});
});

您缺少配置的一个重要部分。从错误中可以看出,esrimap获取的url不正确。这是因为您尚未设置服务器,如您所指的示例所示:

//This service is for development and testing purposes only. We recommend that you create your own geometry service for use within your applications. 
config.defaults.geometryService = new GeometryService("http://sampleserver6.arcgisonline.com/arcgis/rest/services/Utilities/Geometry/GeometryServer");
关于Plunker的简单简化示例

  var map;
  require([
    "esri/map", 
    "esri/arcgis/utils",
    "esri/tasks/GeometryService",
    "esri/config",
  ], function(
      Map,
      arcgisUtils,
      GeometryService,
      config
  ) {
      config.defaults.geometryService = new GeometryService("http://sampleserver6.arcgisonline.com/arcgis/rest/services/Utilities/Geometry/GeometryServer");
      config.defaults.io.proxyUrl = "/proxy/";
      arcgisUtils.createMap("a193c5459e6e4fd99ebf09d893d65cf0", "mapDiv").then(function(response){
         window.map = response.map;
    });
});

我必须运行自己的服务器吗?我可以不使用esri测试他们的示例吗?如果我确实需要运行自己的服务器,我需要做什么?有关于设置的文件吗?-感谢您不要出于测试/开发目的。我编辑了我的示例,以便您可以看到它与他们在示例中使用的URI一起工作。但我想你会想的,因为他们的地图已经有了自定义的几何图形。如果你想要自己的地图,你可以在