传单地图,通过按钮获取geojson文件的具体数据
问题描述
我正在尝试使用按钮在我的 geojson 文件的地图特定值 (data.geojson) 上显示.(例如绘制只有值domaine"的地图:violences")
I'm triying to display on my map specific value ( data.geojson) of my geojson file with buttons. (for exemple to plot a map with only value "domaine":"violences ")
我正在寻找一种方法,通过我的地图上的按钮来依赖我的数据(domaine":violences"或其他)?
I am loocking for a way to rely my data ("domaine":"violences" or other)with a buttons on my map ?
非常感谢您抽出宝贵时间.我的js:
Thanks so much in advance for your time. my js:
data.geojson
the data.geojson
推荐答案
至于打开/关闭你的类别,你可以使用 Leaflet Layers Control L.control.layers
.
As for toggling ON / OFF your categories, you could use Leaflet Layers Control L.control.layers
.
至于按类别(在您的情况下为域")对功能进行分组,请参阅我在评论中链接的帖子:传单:如何从单个集合中切换 GeoJSON 功能属性?
As for grouping your features by category ("domaine" in your case), see the post I linked in my comment: Leaflet: How to toggle GeoJSON feature properties from a single collection?
您甚至可以通过直接使用图层组来稍微简化它L.layerGroup
而不是使用中间数组.
You could even slightly simplify it by directly using Layer Groups L.layerGroup
instead of using intermediate arrays.
演示:https://plnkr.co/edit/H6E6q0vKwb3RPOZBWs27?p=preview
这篇关于传单地图,通过按钮获取geojson文件的具体数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!