Leaflet-Search plugin error. No result for type Point in GeoJSON

20 views
Skip to first unread message

Andrew Foxis

unread,
Feb 11, 2018, 4:30:20 AM2/11/18
to Leaflet

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 (


Reply all
Reply to author
Forward
0 new messages