-
-
Notifications
You must be signed in to change notification settings - Fork 730
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
Certain lat/lngs, zoom and styles throws error: Cannot read properties of null (reading 'point') #1224
Comments
placeGlyphALongALine was recently changed in order to allow placing symbols up right for every letter. |
With versions 2.1.8, 2.1.7, 2.1.6, 2.1.1, 2.1.0, 2.0.0, 1.15.2, 1.14.0, I get the same error. |
Ok, thanks, this means this is not new. |
@klokan can you check if maptiler API key is blocking jsbin? I can't seem to be able to see the provided example. |
We ran into this same problem today, so this is still an issue with 4.7.1. Troubleshooting ended up with the same conclusion as @willheslam, its unsafe to assume that first/last glyphs being placed is sufficient to render the remaining glyphs. In our particular case, we're using openmaptiles styles and I was able to update the style for the name attributes for the layer that was causing the error from |
maplibre-gl-js version: 2.1.9
browser: Chrome 100.0.4896.127 on OSX
Steps to Trigger Behavior
Certain lng lat coordinates, with certain zoom settings, e.g.
cause maplibre to throw an error whilst rendering:
It seems to be dependent on specific latlngs and zoom and styles.
For example, zoom 19 or 21 doesn't trigger the error, nor does 19.9 or 20.6 (but 20.5 does)
Using the 'streets' style
'https://api.maptiler.com/maps/streets/style.json?key=get_your_own_OpIi9ZULNHzrESv6T2vL'
doesn't trigger the error but 'basic' does.
Here's a screenshot from jsfiddle:
and here's a screenshot from the app I first encounted this bug with (using react-map-gl as a layer on top of maplibre-gl)
It's specifically coming from these lines:
Logging out
placedGlyphs
results inand the
null
items come specifically from this line:inside the function
placeGlyphAlongLine
this condition is occurring:It's unclear if this is ever expected to happen as I don't have a good understanding of the code, but given items inside
placedGlyphs
can in some circumstances be null,addDynamicAttributes(dynamicLayoutVertexArray, glyph.point, glyph.angle);
is unsafe - either there shouldn't be nulls in the array, or nulls need to be checked for and handled appropriately - I suspect the former though I'm not sure what the context is.My best guess is there is some kind of geometry at the coords and zoom level I described that triggers this problem.
Link to Demonstration
This JS bin demonstrates the problem, but you'll need to open the dev console to see the error:
https://jsbin.com/jociwic/1/edit?html,output
You should see:
or alternatively with jsbin:
Create a JS fiddle from https://maplibre.org/maplibre-gl-js-docs/example/simple-map/
and set the JS to
The text was updated successfully, but these errors were encountered: