给要素图层添加信息窗口
程序员文章站
2022-05-23 12:40:59
要注意,书写时遵循先行性,程序之后用的所有,之前必须设置或定义好,否则没有效果出现 var serviceUrl = "https://services.arcgis.com/V6ZHFr6zdgNZuVG0/ArcGIS/rest/services/NYCDemographics1/Feature ......
要注意,书写时遵循先行性,程序之后用的所有,之前必须设置或定义好,否则没有效果出现
var serviceurl = "https://services.arcgis.com/v6zhfr6zdgnzuvg0/arcgis/rest/services/nycdemographics1/featureserver/0";
var popuptemplate = {
title:"marriage in ny, zip code:{zip}",
content:{
type:"fields",
fieldinfos:[{
fieldname:"",
label:"",
format:{
place:0,
digitseparator:true
}
},{},...]
}
}
var layer = new featurelayer({
url:serviceurl,
outfields:["*"],
popuptemplate:popuptemplate
})
var map = new map({
basemap:"dark-gray"
});
map.add(layer);
var view = new mapview({
container:"viewdiv",
map:map,
center:[-73.950, 40.702],
zoom:13
})
上一篇: 成功和失败是可以同时出现的