arcgis for js 4.5 部署到tomcat报错
1.已经将arcgis js放在tomcat目录下...apache-tomcat-7.0.57\webapps\arcgis\arcgis_js_v45_api\arcgis_js_api\library\4.5\dojo
2.dojo.js也修改如下:
baseUrl:"http://localhost:8080/arcgis/a ... ot%3B
3.jsp引进css和js
<link rel="stylesheet" href="http://localhost:8080/arcgis/a ... ot%3B />
<link rel="stylesheet" href="http://localhost:8080/arcgis/a ... ot%3B />
<script src="http://localhost:8080/arcgis/a ... jo.js"></script>
4.访问arcgis server的地图
<script>
var myMap, view;
require([
"esri/Basemap",
"esri/layers/TileLayer",
"esri/Map",
"esri/views/MapView",
"dojo/domReady!"
], function (Basemap, TileLayer, Map, MapView){
// --------------------------------------------------------------------
// If you do not have public Internet access then use the Basemap class
// and point this URL to your own locally accessible cached service.
//
// Otherwise you can just use one of the named hosted ArcGIS services.
// --------------------------------------------------------------------
var layer = new TileLayer({
url: "http://172.21.241.165:6080/arc ... ot%3B
});
var customBasemap = new Basemap({
baseLayers: [layer],
title: "Custom Basemap",
id: "myBasemap"
});
myMap = new Map({
basemap: customBasemap
});
view = new MapView({
center: [-111.87, 40.57], // long, lat
container: "viewDiv",
map: myMap,
zoom: 6
});
});
</script>
5.执行结果报错:
2.dojo.js也修改如下:
baseUrl:"http://localhost:8080/arcgis/a ... ot%3B
3.jsp引进css和js
<link rel="stylesheet" href="http://localhost:8080/arcgis/a ... ot%3B />
<link rel="stylesheet" href="http://localhost:8080/arcgis/a ... ot%3B />
<script src="http://localhost:8080/arcgis/a ... jo.js"></script>
4.访问arcgis server的地图
<script>
var myMap, view;
require([
"esri/Basemap",
"esri/layers/TileLayer",
"esri/Map",
"esri/views/MapView",
"dojo/domReady!"
], function (Basemap, TileLayer, Map, MapView){
// --------------------------------------------------------------------
// If you do not have public Internet access then use the Basemap class
// and point this URL to your own locally accessible cached service.
//
// Otherwise you can just use one of the named hosted ArcGIS services.
// --------------------------------------------------------------------
var layer = new TileLayer({
url: "http://172.21.241.165:6080/arc ... ot%3B
});
var customBasemap = new Basemap({
baseLayers: [layer],
title: "Custom Basemap",
id: "myBasemap"
});
myMap = new Map({
basemap: customBasemap
});
view = new MapView({
center: [-111.87, 40.57], // long, lat
container: "viewDiv",
map: myMap,
zoom: 6
});
});
</script>
5.执行结果报错:
4 个回复
Anyway
赞同来自:
因为左上角有加减的操作杆,以及右下角有"powered by Esri"字样出现。
但不知道为什么会报Uncaught TypeError: Cannot read property 'pause' of null错误。
小弟初学,有大神帮忙看下原因吗?万分感谢!!
GIS晴天 - webgis爱好者
赞同来自:
只需将[HOSTNAME_AND_PATH_TO_JSAPI]替换为
localhost/arcgis_js_v45_api/arcgis_js_api/library/4.5/
注意要将https改为http否则是不可以的,结果如图:
经过测试,可以正常运行,希望能帮到你!
mushroom
赞同来自:
bafam
赞同来自:
要回复问题请先登录或注册
发起人
相关问题
问题状态