欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

给要素图层添加信息窗口

程序员文章站 2023-08-22 12:24:26
要注意,书写时遵循先行性,程序之后用的所有,之前必须设置或定义好,否则没有效果出现 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

})