Git Product home page Git Product logo

Comments (19)

mountainvat avatar mountainvat commented on May 22, 2024

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.

from google-maps-ios-utils.

mountainvat avatar mountainvat commented on May 22, 2024

FYI: I've just briefly tried to reproduce on my side but failed. So I am waiting for more information.

from google-maps-ios-utils.

SAPIENTechnologies avatar SAPIENTechnologies commented on May 22, 2024

Its very odd. Here is the only place where I call cluster()

func clusterMarkers () {
    //clear out the marker array
    self.markers.removeAll()

    //clear out the cluster manager items
    mapViewController.clusterManager.clearItems()

    self.clusterManager.add(trucks)

    // Call cluster() after items have been added to perform the clustering
    // and rendering on map.
    mapViewController.clusterManager.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
I start out with 5 items in my trucks array.
I add the trucks array to cluster manager
I call cluster()

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,
[email protected]

On Nov 17, 2016, at 1:25 PM, Son Nguyen [email protected] wrote:

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.


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/AOoyM7ZU3IfrKsj8JKVtaf1FXFcQmS2Vks5q_MZdgaJpZM4K1n7T.

from google-maps-ios-utils.

mountainvat avatar mountainvat commented on May 22, 2024

So in the willRenderMarker handler, can you log the map's camera zoom out and paste them here?

from google-maps-ios-utils.

SAPIENTechnologies avatar SAPIENTechnologies commented on May 22, 2024

Its always the same:

16.0
16.0
16.0
16.0
16.0
16.0
16.0
16.0
16.0
16.0
16.0
16.0

Regards,
[email protected]

On Nov 17, 2016, at 2:20 PM, Son Nguyen [email protected] wrote:

So in the willRenderMarker handler, can you log the map's camera zoom out and paste them here?


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/AOoyM2tK6xkn8j4JWvSfzoLaOl00lmgxks5q_NMtgaJpZM4K1n7T.

from google-maps-ios-utils.

mountainvat avatar mountainvat commented on May 22, 2024

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?

from google-maps-ios-utils.

SAPIENTechnologies avatar SAPIENTechnologies commented on May 22, 2024

There are 4 trucks in my viewport here is the output

ID: 2
Zoom level: 16.0
Latitude: 38.2556198811391
Longitude: -122.27283205837

ID: 3
Zoom level: 16.0
Latitude: 38.2556198811391
Longitude: -122.27283205837

ID: 5
Zoom level: 16.0
Latitude: 38.2556198811391
Longitude: -122.27283205837

ID: 6
Zoom level: 16.0
Latitude: 38.2556198811391
Longitude: -122.27283205837

ID: 2
Zoom level: 16.0
Latitude: 38.2556198811391
Longitude: -122.27283205837

ID: 3
Zoom level: 16.0
Latitude: 38.2556198811391
Longitude: -122.27283205837

ID: 5
Zoom level: 16.0
Latitude: 38.2556198811391
Longitude: -122.27283205837

ID: 6
Zoom level: 16.0
Latitude: 38.2556198811391
Longitude: -122.27283205837

Regards,
[email protected]

On Nov 17, 2016, at 2:52 PM, Son Nguyen [email protected] wrote:

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?


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/AOoyMy5OO8K5aUBSjAkKDubTjK5nZ-1_ks5q_NqzgaJpZM4K1n7T.

from google-maps-ios-utils.

SAPIENTechnologies avatar SAPIENTechnologies commented on May 22, 2024

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
Zoom level: 16.0
Latitude: 38.2556198811391
Longitude: -122.27283205837

ID: 3
Zoom level: 16.0
Latitude: 38.2556198811391
Longitude: -122.27283205837

ID: 5
Zoom level: 16.0
Latitude: 38.2556198811391
Longitude: -122.27283205837

ID: 6
Zoom level: 16.0
Latitude: 38.2556198811391
Longitude: -122.27283205837

ID: 2
Zoom level: 16.0
Latitude: 38.2556198811391
Longitude: -122.27283205837

ID: 3
Zoom level: 16.0
Latitude: 38.2556198811391
Longitude: -122.27283205837

ID: 5
Zoom level: 16.0
Latitude: 38.2556198811391
Longitude: -122.27283205837

ID: 6
Zoom level: 16.0
Latitude: 38.2556198811391
Longitude: -122.27283205837

Regards,
[email protected]

On Nov 17, 2016, at 2:52 PM, Son Nguyen [email protected] wrote:

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?


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/AOoyMy5OO8K5aUBSjAkKDubTjK5nZ-1_ks5q_NqzgaJpZM4K1n7T.

from google-maps-ios-utils.

mountainvat avatar mountainvat commented on May 22, 2024

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?

from google-maps-ios-utils.

SAPIENTechnologies avatar SAPIENTechnologies commented on May 22, 2024

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?

from google-maps-ios-utils.

domesticmouse avatar domesticmouse commented on May 22, 2024

Please feel free to email me the repro, or link to it, at [email protected]

from google-maps-ios-utils.

domesticmouse avatar domesticmouse commented on May 22, 2024

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!

from google-maps-ios-utils.

SAPIENTechnologies avatar SAPIENTechnologies commented on May 22, 2024

from google-maps-ios-utils.

SAPIENTechnologies avatar SAPIENTechnologies commented on May 22, 2024

from google-maps-ios-utils.

domesticmouse avatar domesticmouse commented on May 22, 2024

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 use_frameworks! declared in it. From memory your reproduction instance didn't have that in it. It also had a lot of other stuff. I like to get people to boil down their issues to a minimal reproduction, as that exercise frequently shows the problem directly, or failing that, limits the search I have to make to figure out the problem.

So, please create a minimal repro case of the issue you are facing. Thanks!

from google-maps-ios-utils.

PatoSalazarNascent avatar PatoSalazarNascent commented on May 22, 2024

Also have the same issue. Could not use the podfile as my app is using use_frameworks!. Will Render is getting called twice for each marker.

For one single marker and a cluster marker (of six clusterItems) if I print inside the willRender method I get

render
render
render
render

also calling cluster only once when a promise resolves.

    private func getHotpotsLocations() {
        hotspotProtocol.getItemsByBounds(bounds: getVisibleBounds())
            .then {
                [weak self = self]
                clusterItems -> Void in
                
                for item in clusterItems {
                    
                    if WifiHotspotsViewController.isCoordinateInvalid(coord: item.position) {
                        print("MAPKIT NAME ===> \(item.name)")
                        print("MAPKIT ADDRESS ===> \(item.address)")
                        print("MAPKIT LATITUDE ===> \(item.position.latitude)")
                        print("MAPKIT LONGITUDE ===> \(item.position.longitude)")
                        
                        continue
                    }
                    
                    self?.clusterManager.add(item)
                }
                
                self?.clusterManager.cluster()
            }
            .catch {
                error in
                
                print(error)
        }
    }

This is what is inside my willRender method

    internal func renderer(_ renderer: GMUClusterRenderer, willRenderMarker marker: GMSMarker) {
        print("render")
        if let clusterData = marker.userData as? GMUCluster {
            marker.iconView = UIImageView(image: getClusterIcon(itemsCount: clusterData.count))
        }
        else {
            marker.iconView = UIImageView(image: UIImage(named: "singlePin"))
        }
    }

from google-maps-ios-utils.

frios avatar frios commented on May 22, 2024

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().

from google-maps-ios-utils.

stale avatar stale commented on May 22, 2024

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!

from google-maps-ios-utils.

stale avatar stale commented on May 22, 2024

Closing this. Please reopen if you believe it should be addressed. Thank you for your contribution.

from google-maps-ios-utils.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.