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);
}
}
});
}
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 记一次.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中文教程