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

Slow rendering of zoomed map with polylines #990

Closed
mchesnokov opened this issue Aug 5, 2021 · 9 comments
Closed

Slow rendering of zoomed map with polylines #990

mchesnokov opened this issue Aug 5, 2021 · 9 comments

Comments

@mchesnokov
Copy link

I put a couple of polylines on the map. If I zoom from min zoom to see small towns and villages map is being re-build with some freezes. Other widgets above the map also experience some freezes. If I don't put any polylines, the map works good and doesn't freeze.

I supposed it is because of redrawing polylines outside the viewport. So I set polylineCulling: true but got LateInitializationError: Field 'boundingBox' has already been initialized
since polyline.boundingBox is final but PolylineLayerOptions constructor tries to set its value.
Making boundingBox not final doesn't seem to make polylineCulling work. Or the reason of map freezes is something else.

@JaffaKetchup
Copy link
Member

JaffaKetchup commented Aug 5, 2021

Seems like that LateInitializationError error is plaguing flutter_map at the moment. Not sure what to recommend, other than waiting unfortunately. There may be open PR that may fix your issue...

@mchesnokov
Copy link
Author

At the moment I am not sure that this error causes freezes. Since making boundingBox not final stops the error but not the freezes. I haven't debugged it yet but have a feeling that the code which updates boundingBox if polylineCulling is true does not really archive intended effects.

@ibrierley
Copy link
Collaborator

Ignoring the late init error for the moment, you mention a "couple" of polylines, but then mention small towns and villages map (I'm assuming we're not talking raster images here?), so I'm wondering how detailed these polylines are. Again, I may be misunderstanding that.

@mchesnokov
Copy link
Author

Do you mean polyline points? If yes, then each polyline has 181 points (one for each latitude int degree).
Mentioning villages and towns I meant the zoom level from which freezes become noticible, sorry I should have given a zoom value instead to be precise.

@ibrierley
Copy link
Collaborator

So, do you mean there's a lot more than 2 polylines in total (how many if so), but only 2 would be visible at higher zooms and it's too slow still?

@mchesnokov
Copy link
Author

Lets simplify it - single polyline of 181 points: latitude goes from -65˚ to 65˚ and longitude from -180˚ to 180˚.
After I zoom the map to level close to 10 and then move it with a finger gesture, I can notice some freezing of map updating. If I zoom more these freezes become more noticeable. Reproduced with any value of polylineCulling.
When I also add a https://pub.dev/packages/sliding_up_panel widget covering a part of the map area and slide it up or down it also works with freezes (here I suppose that panel renders everything that under it - map in my case, so the reason of panel freezes seem to be the same as map freezes when moving it - rendering of polyline, I guess even those parts of it which are out of viewport).
Without a polyline everything works perfect.

@ibrierley
Copy link
Collaborator

Curious. Just out of interest, if you make the polyline have a stroke width of 0 only (just for testing), does it have any effect on the freezes ?

@mchesnokov
Copy link
Author

@ibrierley Thank you very much for mentioning stroke. My problematical polyline is dotted. When I make it regular line, no freezes! So I guess by now I have to switch to isDotted: false, unfortunatelly. I appreciate if you consider a possibility of making dotted polylines work fast (but I guess they should take more time to be drawn).
Thanks again.

@ibrierley
Copy link
Collaborator

ibrierley commented Aug 6, 2021 via email

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

No branches or pull requests

3 participants