leaflet-search icon indicating copy to clipboard operation
leaflet-search copied to clipboard

Error 561 and not result from GeoJSON. (Typy Point!)

Open arpsyapathy opened this issue 7 years ago • 0 comments

Hello! I try to connect Leaflet search plugin to my map with GeoJSON data. But i get error( 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 P.S. ggg - layer with geojson data
I understand because of this error the reason that do not give you any search results.

Help please in solving problems Thanks you!

GeoJSON data - http://ignn.ru/test/test.js

UPD: In data there is a single object of type point. When I remove it-everything works. But I need the elements of type point (

arpsyapathy avatar Feb 11 '18 09:02 arpsyapathy