I cannot get the fitBounds command to work on a project where I am bringing in data to a featureLayer using GeoJSON.
This:
map.fitBounds(pointsFeatureGroup.getBounds()); // Uncaught Error: Bounds are not valid. at e.fitBounds (leaflet.js:5)
and this:
var bounds = L.latLngBounds(pointsFeatureGroup); // Uncaught Error: Bounds are not valid. at e.fitBounds
map.fitBounds(bounds);
don't work
My simplified code is here: https://github.com/DPB61/leafletjs_problem2
If I just bring in markers individually into a normal Layer then a command like this works:
map.fitBounds(PointsLayer.getBounds());
but that raises other issues with other functionality for which a features layer is required.
Am I doing something wrong?