Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Calling getBounds on a GeodesicCircle throws an error #48

Closed
jziggas opened this issue Nov 12, 2019 · 5 comments
Closed

Calling getBounds on a GeodesicCircle throws an error #48

jziggas opened this issue Nov 12, 2019 · 5 comments
Assignees
Labels

Comments

@jziggas
Copy link

jziggas commented Nov 12, 2019

I have a FeatureGroup that can contain a number of Rectangles, Circles, or GeodesicCircles. On page load I call map.fitResults(featureGroup.getBounds()) to zoom in and fit the view of the map to nicely contain all of the geoshapes. It looks like calling getBounds() on a FeatureGroup internally calls getBounds() on each of the underlying layers, but GeodesicCircle doesn't have that method and an error gets thrown when that layer is reached.

Polylines however do have the getBounds() method and I was able to temporarily resolve this issue by defining a new method on each instance of a GeodesicCircle:

circle = L.geodesiccircle(...)
(circle as any).getBounds = () => circle.polyline.getBounds();
@henrythasler henrythasler self-assigned this Nov 13, 2019
@henrythasler
Copy link
Owner

I agree. This, and maybe other methods, need to be included in the geodesic-classes.

@jziggas
Copy link
Author

jziggas commented Nov 13, 2019

Yeah there may be more missing methods but that's as far as I went with it. I noticed GeodesicCircleClass extends L.Layer but it almost seems like it should be extending or otherwise also inheriting (mixin?) from L.Circle to get those methods. 🤷‍♂

@henrythasler
Copy link
Owner

henrythasler added a commit that referenced this issue Nov 15, 2019
@henrythasler
Copy link
Owner

Release is v2.3.1

@jziggas
Copy link
Author

jziggas commented Nov 15, 2019

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants