我的github
posts - 3243,  comments - 42,  views - 158万

1. geojson数据:https://blog.csdn.net/weixin_38307752/article/details/84112566

2. 简单要素的添加:https://blog.csdn.net/xcymorningsun/article/details/83409568

二、简单要素点线面的添加

1、创建feature

2、创建style,添加source、style到layer

3、添加layer到map

通过WFS服务获取geojson数据,然后将整个geojson数据加载到vectorlayer图层中去,不过这种方法有个缺点就是不能实现自定义加载各种数据。如果需要对geojson数据中的属性进行修改添加的时候不容易控制(这在以后为每个feature在地图上同时添加气泡框功能有帮助),然后有了这篇文章。

1、创建feature

 

 

>>参考:esri-leaflet:

var loadData = function (){
          $.ajax(url_link, {//leaflet/data/MegaCities.geojson    //url_link   //'leaflet/data/arcgis_json.json'
              dataType: "json",
              success: function(response){
                geojson1 = L.esri.Util.arcgisToGeoJSON(response);
                geoJSONLayer = L.geoJSON(geojson1);//,{onEachFeature:popUp}
                //geoJSONLayer.addTo(map);

                //第二种添加方法
                for(var i in geojson1.features){
                  //alert(i);//geojson1.features[i]
                  DTmap[i] = L.geoJSON(geojson1.features[i],{//response
                    style:function(feature){
                      return{
                        color:'#FF0000',
                        fillOpacity: 0.2,
                        weight:3,
                        dashArray:'10'
                      };
                    }
                  }).bindTooltip("<div id='table'><ul><li>"+geojson1.features[i].properties.OBJECTID+"</li><li>" + "</li><li>",{
                    direction:'top'
                  }).on({
                    mouseover: highlight, //鼠标移动上去高亮
                    mouseout: resetHighlight, //鼠标移出恢复原样式
                    click: zoomTo //点击最大化
                  }).addTo(cities);
                }
              }
          });
      }
posted on   XiaoNiuFeiTian  阅读(592)  评论(0编辑  收藏  举报
编辑推荐:
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
· 没有源码,如何修改代码逻辑?
阅读排行:
· 分享4款.NET开源、免费、实用的商城系统
· 全程不用写代码,我用AI程序员写了一个飞机大战
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
· 上周热点回顾(2.24-3.2)
历史上的今天:
2020-11-24 QGIS Server如何启动,发布服务?
2020-11-24 Qt osgEarth 编程入门
2020-11-24 三维gis开发引擎——ogre和osg和osgearth对比
2017-11-24 TensorFlow中文手册
2017-11-24 TensorFlow中文教程
< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

点击右上角即可分享
微信分享提示