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

map.fitBounds make a "Cannot read properties of null (reading '3')" #12604

Closed
MrDiablon opened this issue Mar 6, 2023 · 2 comments · Fixed by #12605
Closed

map.fitBounds make a "Cannot read properties of null (reading '3')" #12604

MrDiablon opened this issue Mar 6, 2023 · 2 comments · Fixed by #12605
Labels

Comments

@MrDiablon
Copy link

MrDiablon commented Mar 6, 2023

mapbox-gl-js version: 2.13.0

browser: Chrome - Safari

Link to Demonstration

https://jsfiddle.net/Ld21p6w7/1/

Expected Behavior

zoom on the point of the map

Actual Behavior

nothing append and mapbox do nothing after that.
It's look like that the point use in the demonstration is too close from each other. After moving it a bite every thing is ok.

@stepankuzmin
Copy link
Contributor

Hi @MrDiablon

You seem to be trying to use LngLatLike to extend the LngLatBounds. The problem is that LngLatLike should be in the shape of {lon: number, lat: number}, so you'd need to change lng to lon to make it work.

const points = [
  { lat: 50.614351539999994, lon: -2.49247692 },
  { lat: 50.614341849999995, lon: -2.49248475 },
  { lat: 50.6143484, lon: -2.492463 },
];

@stepankuzmin
Copy link
Contributor

Apparently, it's a bug on the GL JS side, LngLatBounds should support extending with {lng: number, lat: number}.

Made a fix for that #12605

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

Successfully merging a pull request may close this issue.

2 participants