概述
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no">
<title>Intro to graphics - 4.10</title>
<script type="text/javascript" src="http://ajax.microsoft.com/ajax/jquery/jquery-1.4.min.js"></script>
<link rel="stylesheet" href="https://js.arcgis.com/4.10/esri/css/main.css">
<script src="https://js.arcgis.com/4.10/"></script>
<style>
html,
body,
#viewDiv {
padding: 0;
margin: 0;
height: 100%;
width: 100%;
}
</style>
<script>
require([
"esri/Map",
"esri/views/MapView",
"esri/layers/TileLayer",
"esri/Graphic"
], function(
Map, MapView, TileLayer,Graphic
) {
var housingLayer = new TileLayer({
url:"https://server.arcgisonline.com/ArcGIS/rest/services/Reference/World_Transportation/MapServer",
id: "ny-housing",
opacity: 0.9
})
var map = new Map({
basemap: "streets",
layers: [housingLayer]
});
var view = new MapView({
center: [118.55019107002441,29.300640724771107],
container: "viewDiv",
map: map,
zoom: 4
});
var markerSymbol = {
type: "simple-marker", // autocasts as new SimpleMarkerSymbol()
color: [226, 119, 40],
outline: { // autocasts as new SimpleLineSymbol()
color: [255, 255, 255],
width: 2
}
};
$(function (){
$.getJSON("./heat.json",function(data){
$.each(data,function(index,info){
x =info.x;
y =info.y;
var point = {
type: "point", // autocasts as new Point()
longitude: x,
latitude: y
};
var pointGraphic = new Graphic({
geometry: point,
symbol: markerSymbol
});
view.graphics.add(pointGraphic);
});
})
});
//监听图层加载完成事件,缩放到图层范围
// view.when(function() {
// housingLayer.when(function() {//es6语法
// view.goTo(housingLayer.fullExtent);
// });
// });
});
</script>
</head>
<body>
<div id="viewDiv"></div>
</body>
</html>
最后
以上就是迅速唇膏为你收集整理的arcgis图层加载以及调用json文件显示在地图上的全部内容,希望文章能够帮你解决arcgis图层加载以及调用json文件显示在地图上所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
发表评论 取消回复