在要素图层上设置属性
可以在要素图层上设置其他属性,以更改其绘制和行为方式。将definitionExpression设置为仅绘制海拔增益小于250英尺renderer
的路径,a 将路径绘制为绿色,a popupTemplate
将显示路径名称和弹出窗口中的所有字段。
// Trails feature layer (lines) var trailsLayer = new FeatureLayer({ url: "https://services3.arcgis.com/GVgbJbqm8hXASVYi/arcgis/rest/services/Trails/FeatureServer/0", //*** ADD ***// definitionExpression: "ELEV_GAIN < 250", //*** ADD ***// renderer: { type: "simple", symbol: { type: "simple-line", color: "green", width: "2px" } }, //*** ADD ***// outFields: ["TRL_NAME","ELEV_GAIN"], //*** ADD ***// popupTemplate: { // Enable a popup title: "{TRL_NAME}", // Show attribute value content: "The trail elevation gain is {ELEV_GAIN} ft." // Display text in pop-up } });
本博有部分内容来自网络,如有问题请联系:hebeilijianghua@qq.com,并注明来自博客园。