leaflet 添加featureLayer 并自定义样式

 1             let url = "https://xxx.arcgis.com/arcgis/rest/services/line_0706_3857/FeatureServer/0"; //此处为地址样式,不是完整的地址,请填写服务的完整地址。
 2                         
 3             var LineLayer = esri.featureLayer({
 4                 url: url,
 5                 style: function (feature) {
 6                     var c = '#007D7D';;
 7                     var o = 0.95;
 8                     let width = 3;
 9                     let gj = feature.properties.lineGJ;
10 
11                     if (gj > 0 && gj < 201) {
12                         width = 3
13                     } else if (gj < 200 && gj < 401) {
14                         width = 5;
15                     } else if (gj > 400) {
16                         width = 7;
17                     }
18 
19                     return { color: c, opacity: o, weight: width };
20                 }
21             }).addTo(map);

 

 
posted @ 2020-07-14 16:08  googlegis  阅读(1726)  评论(0编辑  收藏  举报

坐标合肥,非典型GIS开发人员 GitHub