I try to connect Leaflet search plugin to my map with GeoJSON data. But when I enter a search query in browser inspector I get error: layer.getBounds is not a function in leaflet-search.js
. You can see it on http://ignn.ru/test/ (try to input "Volgograd" or "Alaska")
var searchControl = new L.Control.Search({
layer: ggg,
propertyName: 'name',
marker: false,
moveToLocation: function(latlng, title, map) {
//map.fitBounds( latlng.layer.getBounds() );
var zoom = map.getBoundsZoom(latlng.layer.getBounds());
map.setView(latlng, zoom); // access the zoom
}
});
map.addControl( searchControl );
I did this on example http://labs.easyblog.it/maps/leaflet-search/examples/geojson-layer.html
ggg: layer with geojson data
I understand because of this error the reason that do not give you any search results.
GeoJSON data - http://ignn.ru/test/test.js
Update:
In data there is a single object of type point
. When I remove it, everything works. But I need the elements of type point.