Comments (19)
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.
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.
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.
So in the willRenderMarker handler, can you log the map's camera zoom out and paste them here?
from google-maps-ios-utils.
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.
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.
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.
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.
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.
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.
Please feel free to email me the repro, or link to it, at [email protected]
from google-maps-ios-utils.
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.
from google-maps-ios-utils.
from google-maps-ios-utils.
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.
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.
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.
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.
Closing this. Please reopen if you believe it should be addressed. Thank you for your contribution.
from google-maps-ios-utils.
Related Issues (20)
- Equivalent of MultiPoint, MultiLineString, MultiPolygon HOT 2
- Question. How to set background color and text style in icon generator?
- Update documentation to use latest version of Maps SDK for iOS HOT 1
- Impossible to add GoogleMaps & GooglePlaces to project using Carthage HOT 2
- IconGenerator Text Color is always white HOT 2
- Failed to build module 'GoogleMapsUtils' HOT 4
- Unit tests workflow depends on Carthage
- map flickering issue HOT 1
- No such module HOT 1
- [Question] Will you release e.g. 4.2.0 on cocoapods with latest commit regarding Apple Silicon support? HOT 11
- Warning: Error creating LLDB target at path HOT 2
- The automated release is failing 🚨 HOT 1
- snippet-bot full scan
- 4.2.0 version not building cause of missing xframework file HOT 2
- SPM error cannot resolve it. HOT 2
- Clustering: add setter for clusterDistancePoints in the GMUNonHierarchicalDistanceBasedAlgorithm.m HOT 1
- Clustering : Cluster Markers do not initially hide their items on the map HOT 1
- 4.2.2 does not allow updating to latest GoogleMaps (8.x) HOT 7
- TipKit: when adding popover tip to some view on top of GMSMapView tip starts flickering on every map move HOT 1
- Google maps utils compiler error in new Xcode Version 15.0.1 HOT 38
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from google-maps-ios-utils.