-
Notifications
You must be signed in to change notification settings - Fork 407
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
GMUClusterRendererDelegate willRenderMarker called twice for each marker #58
Comments
The expected behaviour is willRenderMarker should be called only once for each marker being added to the map. However whenever a recluster needs to be done (zooming in/out far enough from current zoom) the markers will be recreated and willRenderMarker will be called again. Was that what happens? We will try to reproduce on our side too. |
FYI: I've just briefly tried to reproduce on my side but failed. So I am waiting for more information. |
Its very odd. Here is the only place where I call cluster()
I call clusterMarkers from other places but I know its only called once because of the self.markers.removeAll() call. When I look at the self.markers array in my willRendermarker delegate function, it does not get cleared out in between the duplicate render calls. In other words: I start out with the markers array empty in my willRenderMarker delegate function, it renders each marker which I then add to the markers array. But then it renders each marker again, invalidating the first set of markers. But I end up with 10 markers in my markers array. The first 5 are now invalid on the map. I have put in some code to get past the problem in the WillRenderMarker delegate function, but I can’t seem to figure out why the markers are being rendered a second time. Thank you for any input. Regards,
|
So in the willRenderMarker handler, can you log the map's camera zoom out and paste them here? |
Its always the same: 16.0 Regards,
|
There were 12 events in the log above. So sth strange here. Can you also log the camera lat,lng to see if they actually moved? |
There are 4 trucks in my viewport here is the output ID: 2 ID: 3 ID: 5 ID: 6 ID: 2 ID: 3 ID: 5 ID: 6 Regards,
|
Anything new based on the last logging I sent? here it is again There are 4 trucks in my viewport here is the output ID: 2 ID: 3 ID: 5 ID: 6 ID: 2 ID: 3 ID: 5 ID: 6 Regards,
|
The camera did not change throughout so I am not sure what's going on there. Are you able to check out the source, open the workspace/GoogleMapsUtils.xcodeproj and run the DemoApp target and see if it reproduce for the CustomMarkerViewController demo? I was unable to reproduce using that demo. Or else can you create a small repro project that I can take a look? |
This problem still exists. I have created a stripped down version of my project. Is there a private location that I can upload it to for you to take a look at? |
Please feel free to email me the repro, or link to it, at brettmorgan@google.com |
I'm a tad confused, at first blush this app doesn't appear to include I strongly suggest you build a minimal reproduction sample that includes only the Thanks! |
Thats because Google-Maps-iOS-Utils is included as source. See the attached image. When I first incorporated that lib, it was the suggested way to do it. Is it now available as a pod?
This is pretty much the mosts stripped I can get the app and have it be a real representation of the app.
What I have found yesterday is that the size of the marker.userData heavily influences the speed of the clustering. I created a parallel array of “liteTrucks” which include only a truckIdentifier and a position and passed that array to the clusterManager. This increased the clustering speed tremendously.
I am still having issues with willRenderMarker being called multiple times for the same marker though.
Regards,
info@sapien.com
… On May 25, 2017, at 5:07 PM, Brett Morgan ***@***.***> wrote:
I'm a tad confused, at first blush this app doesn't appear to include Google-Maps-iOS-Utils in the Podfile. It includes a bunch of other detail that isn't helpful with respect to debugging the issue.
I strongly suggest you build a minimal reproduction sample that includes only the GoogleMaps and Google-Maps-iOS-Utils pods, and post it up as a github repo that I can clone and fix.
Thanks!
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub <#58 (comment)>, or mute the thread <https://github.com/notifications/unsubscribe-auth/AOoyM4PGtsDwCWaNK02lv_fFeoPybbcIks5r9hengaJpZM4K1n7T>.
|
Here is the reason I don’t use the podfile:…
https://github.com/googlemaps/google-maps-ios-utils/blob/master/Swift.md
Regards,
info@sapien.com
… On May 25, 2017, at 5:07 PM, Brett Morgan ***@***.***> wrote:
I'm a tad confused, at first blush this app doesn't appear to include Google-Maps-iOS-Utils in the Podfile. It includes a bunch of other detail that isn't helpful with respect to debugging the issue.
I strongly suggest you build a minimal reproduction sample that includes only the GoogleMaps and Google-Maps-iOS-Utils pods, and post it up as a github repo that I can clone and fix.
Thanks!
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub <#58 (comment)>, or mute the thread <https://github.com/notifications/unsubscribe-auth/AOoyM4PGtsDwCWaNK02lv_fFeoPybbcIks5r9hengaJpZM4K1n7T>.
|
The instructions in https://github.com/googlemaps/google-maps-ios-utils/blob/master/Swift.md are for the specific case for when you have a Podfile that has So, please create a minimal repro case of the issue you are facing. Thanks! |
Also have the same issue. Could not use the podfile as my app is using For one single marker and a cluster marker (of six clusterItems) if I print inside the willRender method I get
also calling cluster only once when a promise resolves.
This is what is inside my willRender method
|
Do you call clusterManager.clearItems() sometime before this? I was looking at this call and saw that it calls clusterManager.algorithm.clearItems() then calls requestCluster(). That seemed to be the issue for me that created the duplicate willRender calls. I fixed it by calling clusterManager.algorithm.clearItems() directly, bypassing the call to requestCluster(). |
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. |
I have created the GMUClusterRendererDelegate in my code and implemented the willrenderMarker function. I notice that this function loops through the visible markers 2x for each marker. For instance, if I have 5 visible markers, the function gets called for each marker in succession, and then AGAIN for each marker in succession. Is this expected behavior?
The text was updated successfully, but these errors were encountered: