I have been rendering a FeatureCollection of polygons into the Map (in one GeoJSONLayer
). The size of each polygon is big (5mb, 10mb). With user interactions, the colours of polygons would be re-calculated & changed constantly. We are using data-driven
method and keeping the data in properties of each feature. So GeoJSONLayer
has to call .setData(geojson)
everytime the data and colours changed (they are kept in properties).
I find above approach is lead to performance issue since the size of geojsons
is big and calling .setData()
is expensive.
I'm thinking of separating the geojson source and the data, style, colouring and calling direct function (setPaintProperty)
whenever colours changed would be better than.
Someone told me that .setData
and .setPaintProperty
would do the same thing, both 2 will trigger re-rendering whole polygons.
Kindly need help to advice on this matter
Thanks a lot!