GeoJSONLayer does not work with style-update
See original GitHub issueInitially in my code, I was getting this (doesn’t happen in this example PR).
geojson-layer.js:77 Uncaught TypeError: Cannot read property 'setData' of undefined
at GeoJSONLayer.componentWillReceiveProps (geojson-layer.js:77)
Fails right here:
if (props.data !== data) {
(map.getSource(id) as MapboxGL.GeoJSONSource).setData(props.data);
}
map.getSource(id)
is returning undefined
.
I tried cloning the library and updating the example to show this: https://github.com/alex3165/react-mapbox-gl/pull/260
In the example, there are no errors in the console, but the layer is not re-rendered. If you check out that branch and go to the “Style update” tab, you can see what I’m talking about.
If you switch the style the GEOJSONLayer is NOT re-rendered.
Issue Analytics
- State:
- Created 6 years ago
- Comments:13 (9 by maintainers)
Top Results From Across the Web
Solved: Editor widget doesnt work with GeoJSONLayer in 4.2...
I'm not able to get the Editor widget to work with a GeoJSONLayer in the 4.22 version, but in the 4.21 version with...
Read more >GeoJSONLayer | ArcGIS Maps SDK for JavaScript 4.25
Each GeoJSONLayer will only accept one schema of the properties. The fields property can be used to specify the desired fields for the...
Read more >Cluster geojson Layer doesn't work with marker filtering
As I added some filter and styling features according to properties, I'm unable to find the right way to code the cluster fonction....
Read more >JSON layer does not show when .setview changes
I've set a Mapbox map with a GeoJSON layer overlaying it. The problem is that with the default set values, the JSON layer...
Read more >GeoJsonLayer - deck.gl
This prop is effective only when the polygon is NOT extruded. getFillColor (Function|Array, optional) transition-enabled. Default: [0, 0, ...
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
Hey, Thank you for the issue I will handle this with the
v2.0.0
milestonehttps://github.com/alex3165/react-mapbox-gl/pull/269 should fix it