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
App freezes when loading KML layer #582
Comments
@sharkboy777 Could you please provide a sample KML file that you're having this problem with? |
Here is the drive link for kml file... please give me a solution |
any update on this?? |
Got anything on this issue?? Or atleast before adding the kml layer onto the maps, is it possible to get renderer object, to parse the KML data and get the polygons? Why because, right now it seems to be not possible to get the renderer object before adding the KML layer onto maps. |
@sharkboy777 I haven't had time to look at this |
I CPU profiled loading this KML and the bottleneck is calling I'd suggest splitting this KML into 20 smaller KMLs that can be loaded and displayed individually. Even if you display them all at once, you could at least add them to the map on separate main thread run loops to avoid freezing the UI for as long. |
|
If you're unable to edit the KML and break it up into multiple smaller files, I'd suggest still making sure you at least are constructing the For reference, I updated the |
CPU profiling identifies The long-running @jpoehnelt @arriolac hard to know exactly what could be optimized in the closed-source |
@jeffdgr8 Have you tried profiling the library with the Android Maps v3 beta SDK? https://github.com/googlemaps/android-maps-utils/commits/android-sdk-v3-beta We have a similar bottleneck for clustering when adding markers with Maps API v2, and slow performance adding markers was called out as fixed in the Android v3 beta SDK - see #164 (comment). Not sure if this fix also addresses slow performance adding polygons, but 🤞 if it was just a simple Collection sorting issue. |
@barbeau I actually did pull the maps v3 branch to test and ran into this crash again on my Pixel Slate. I'll try profiling again on my phone. I also wanted to merge master into the android-sdk-v3-beta branch, which has conflicts. I was happy to see that performance issue fixed in v3, as I was tracking it closely. There hasn't been much movement on the v3 beta since it was first announced last spring, not even an iterative beta release with that crash fixed. |
I profiled with the maps v3 beta (#608) and actually couldn't get the KML to display on the map at all. The app hung for a few minutes with the main thread blocked and eventually crashed.
Other smaller KML files worked as expected. |
@jeffdgr8 Thanks for checking that out. So is that actually a regression from Maps SDK v2? Would Maps SDK v2 eventually load if you gave it enough time? |
@barbeau yes, with the v2 SDK it takes 10-15 seconds to add the polygons and display on the map. So this is a regression in v3. I created a bug report. |
yes.. for now i am getting the kmllayer object on a background thread and then adding the layertomap using main ui thread. There is another issue in this same kml file, which is it doesn't load the styles but just loads the plain black polygon lines without any fill colors. Raised this issue in the below ticket. Because of the above issue, I had to get all polygon objects from the rendered kmllayer and draw them on maps again using polygon styles to get the output. I don't know exactly if it is the issue with map-utils library or the kml file itself |
@jeffdgr8 , @barbeau Thank you guys for helping out with the issue and reporting it to google. Hope they fix it soon😊😊 |
This issue has been automatically marked as stale because it has not had recent activity. Please comment here if it is still valid so that we can reprioritize. Thank you! |
Not stale. |
This issue has been automatically marked as stale because it has not had recent activity. Please comment here if it is still valid so that we can reprioritize. Thank you! |
Not stale. |
This issue has been automatically marked as stale because it has not had recent activity. Please comment here if it is still valid so that we can reprioritize. Thank you! |
Not stale |
Still useful |
This issue has been automatically marked as stale because it has not had recent activity. Please comment here if it is still valid so that we can reprioritize. Thank you! |
Not stale |
This issue has been automatically marked as stale because it has not had recent activity. Please comment here if it is still valid so that we can reprioritize. Thank you! |
Closing this. Please reopen if you believe it should be addressed. Thank you for your contribution. |
Not Stale, Still m facing this issue with latest sdk in 2024 |
I am trying to add KML layer on to the maps. It was working okay with just a ms of freeze when i try to load the small size KML file. But some files are large with size more than 1Mb - 10Mb.. in these all cases app is getting frozen for some time while the layer is adding to the map.
Below is the Asynctask class i am using to read the kml file from local storage path and adding it to maps.
I tried this in many ways using handlers, threads, asynctasks... as i cannot update the UI in background thread... this is causing my app to freeze for some time.
Eventhough it freezes I wouldn't mind but in some device while the app is frozen if the user interacts with the app then app is getting crashed. In some devices it is displaying "wait" dialog.
Please help me out.
`
private static class AddKMLLayerToMaps extends AsyncTask<String, String, KmlLayer> {
The text was updated successfully, but these errors were encountered: