首页 > 解决方案 > 使用 Leaflet Search 插件搜索 Shapefile

问题描述

我有一张在 CodeSandbox 中构建的地图,可以加载并显示一些 shapefile。我想在此地图中添加一个搜索栏,以便可以搜索 shapefile 的名称。据我所知,我最好的选择是使用 Leaflet 搜索插件 ( https://github.com/stefanocudini/leaflet-search ) 来实现与以下内容相同的效果:https ://labs.easyblog.it/maps /leaflet-search/examples/geojson-layer.html

我不确定如何将插件代码准确地实现到我的地图以使 TestShapefile 可搜索。特别是,我不确定如何从 github 网站加载 .css 和 .js 文件,以及这个插件是否真的可以使用 shapefile 而不是 GeoJSON。任何帮助将这些放在一起将不胜感激。

标签: htmlgithubsearchleafletshapefile

解决方案


推荐阅读