如何在Leaflet

时间:2018-12-04 18:13:49

标签: search fuse

我试图在我的传单地图中实现“ fusesearch”。我在搜索菜单栏中得到了搜索结果,但是当我单击某个结果时,该结果未激活,并且无法缩放以显示结果。这是我的代码:

var options = {
 position: 'topleft',
 title: 'Chercher'
 };
 var searchCtrl = L.control.fuseSearch(options)
 searchCtrl.addTo(mymap);

 proj4.defs("EPSG:32638","+proj=utm +zone=38 +datum=WGS84 +units=m 
 +no_defs");
 var dataValveJSON= new L.GeoJSON();
 // dataValveJSON = $.getJSON('./data/Valve.json');

dataValveJSON = $.getJSON('./data/Valve.json', function (geojson) {
  L.Proj.geoJson(geojson).addTo(mymap);

 });
 dataValveJSON.then(function(data) {
   searchCtrl.indexFeatures(data, ['City', 'Route_Name']);
   L.geoJson(data, {
     onEachFeature: function (feature, layer) {
             feature.layer = layer;
     }
});
});   

0 个答案:

没有答案