`Circle.getBounds()` throws error
See original GitHub issueThis bug was already fixed in previous version https://github.com/Leaflet/Leaflet/issues/1068. But it occurs in new leaflet version.
Here is fiddle - https://jsfiddle.net/kecmw7ms/7/ Tested in Chrome Version 53, Firefox Version 47, Safari Version 10.0
Notes:
- Adding
circle
to the map makes it work - Removing
setView
from map breaks it again
Issue Analytics
- State:
- Created 7 years ago
- Comments:10 (4 by maintainers)
Top Results From Across the Web
leaflet - Error when using Circle getBounds() and contains()
Show activity on this post. I'm getting the error below when trying to run getBounds() and contains() with a Circle shape.
Read more >Can Leaflet method .getBounds() be used on a layer to ...
I am currently getting a leaflet-src.js:1873 Uncaught TypeError: Cannot read property 'lat' of undefined error, but I think I am just doing ...
Read more >Coordinates | Maps JavaScript API - Google Developers
These are automatically converted to LatLngBounds objects. All south , west , north and east must be set, otherwise an exception is thrown....
Read more >Advanced geospatial analysis - Turf.js
Takes a Point and calculates the circle polygon given a radius in degrees, radians, ... Throws. Error - if geoJson is invalid. npm...
Read more >javax.swing.JLabel.getBounds java code examples - Tabnine
draw a circle around the question mark Rectangle cc = new Rectangle(symbol. ... {@inheritDoc} */ @Override public Rectangle getBounds() { if (bounds ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
OK, that might be a bug. The calls to
this._map.layerPointToLatLng()
might be able to be changed intothis._map.options.crs.project()
.Having found this bug recently and seeing there has been discussion about this since 2012 (https://github.com/Leaflet/Leaflet/issues/1068) without solving the issue, I’d like to propose the following:
Circle.getBounds()
when the circle has been added to a mapEven if it’s not the optimal solution I think we can all agree that
Circle.getBounds()
crashing when it hasn’t been added to a map is less than ideal.Polyline
,Polygon
andFeatureGroups
(that don’t containCircles
) do not exhibit this behaviour.Related issues: