googlemaps / google-maps-ios-utils Goto Github PK
View Code? Open in Web Editor NEWGoogle Maps SDK for iOS Utility Library
Home Page: https://developers.google.com/maps/documentation/ios-sdk/utility/
License: Apache License 2.0
Google Maps SDK for iOS Utility Library
Home Page: https://developers.google.com/maps/documentation/ios-sdk/utility/
License: Apache License 2.0
My Podfile looks like:
target 'Telemetry' do
use_frameworks!
//...
pod 'GoogleMaps', '~> 1.13.2'
pod 'Google-Maps-iOS-Utils'
end
end
I get the error The 'MyApp' target has transitive dependencies that include static binaries: (/Users/imac/MyApp/Pods/GoogleMaps/Frameworks/GoogleMaps.framework). Can u help me?
there is no icon generator for ios, but it exists for android which is a huge help.Please include an icon generator for ios
i've implemented marker clustering(Google Maps SDK for iOS Utility Library ) along with google maps.crash i'm getting is on deallocating cluster manager object.i'm deallocating google map and cluster manager objects and delegate in viewDidDisappear and deinit as i'm initialising it in viewDidLoad.it works fine upto 10.0,but for higher when i'm doing same in deinit it's working fine but crashes in lower version.below is my code
deinit{
print("DEINIT")
if(googleMapView != nil){
googleMapView!.removeObserver(self, forKeyPath: "myLocation")
}
if(clusterManager != nil)
{
clusterManager.clearItems()
clusterManager.setDelegate(nil, mapDelegate: nil)
clusterManager = nil
}
}`
After last changes in your master branch I got error in my project which used this library by pods. The problem is maps-ios-utils classes can't figure out where are google-maps headers.
My Podfile fragment:
target 'ClusterCheck' do
pod 'Google-Maps-iOS-SDK', '1.9.2'
pod 'Google-Maps-iOS-Utils-QuadTree', :git => 'https://github.com/DDRBoxman/google-maps-ios-utils.git'
end
It used work perfectly until last changes happened in repository. I'm not strong in Pods, and I have no idea is the reason.
Hi Mickael,
I noticed that there is no feature to remove every cluster and annotations from the map if we want to add some new one. I am trying to make that feature works.
I was thinking that the best way to do it was to keep all the Spot added in a NSMutableArray.
And do a [ArraySpot removeAllObjects] [self.mapView clear] in my mainController. But I think that's not working. The annotations are just added to the old ones. If you got few advice to tell me which direction I should take, it could be really helpful.
Hello, I'm trying to implement Marker Customization described here ->https://github.com/googlemaps/google-maps-ios-utils/blob/master/CustomMarkers.md where explains how to implement in objective C. My project uses swift and my knowlegde in objective C is very low. I've tried to convert the example to swift, but the project doesn't build, trhows an error (see attatchment). With this message i've sent 2 files, an image with the error, and a file with a partial example of my code. is there an issue with my code or something else? Thanks in advance.
P.D.
When i implement Clustering without custom markers everything works fine.
i'm using swift 2.3, cocoapods with static libraries (using bridge header file)
Google-Maps-iOS-Utils (1.1.2), GoogleMaps (2.1.0), and xcode Version 8.0 (8A218a).
example_swift_test.txt
POIItemClass.txt
Looks like its adding the same location to a cluster when a zoom event happens. Do you know anything about this?
Hi there,
I just updated the pod to use the new marker icons, but I get a file not found error for Algo/GMUClusterAlgorithm.h in the GMUClusterManager.h file.
My code is like it is in the example file.
Do you know what could be wrong?
Hi,
Is there any way to change default marker icon in marker clustering?
I would only like to cluster if the number of elements is > than a certain limit otherwise the current one (think is 4) is overkill for some use cases. Is this possible?
Was trying to understand why my code works not as expected and found issue with unit tests.
It seems to be issue with OCMock
Return value cannot be used for method; method signature declares '{?={?=dd}{?=dd}{?=dd}{?=dd}}' but value is '{?={CLLocationCoordinate2D=dd}{CLLocationCoordinate2D=dd}{CLLocationCoordinate2D=dd}{CLLocationCoordinate2D=dd}}
It seems like that when I implement the cluster function on my map, the idleAtCemeraPosition is not being called. It sounds like somewhere is holding the map from idle.
My ios Swift app was using GoogleMaps v1.13.2, today I updated my pods (to 2.0.1), now I am getting the following errors:
Use of undeclared type GMSAutocompleteResultsViewController
Use of undeclared type GMSPlace
I open the GoogleMaps pod and I don't see GMSPlace.h
or GMSAutocompleteResultsViewController.h
files. Were they removed? Why?
Hello.
I have 10 pins on the same latitude and longitude.
When i zoom i see only 1 pin.
Could we make it see all of the pins in a circle for example?
Before I attempt adding marker clusterer to my project, I would like to ask this:
Right now in my project I create a marker for every object of my data model
let marker = GMSMarker(position: position)
....
marker.map = mapView
And I override the following method for presenting my own info window
func mapView(mapView: GMSMapView, markerInfoWindow marker: GMSMarker) -> UIView? {
let infoWindow = NSBundle.mainBundle().loadNibNamed("InfoWindow", owner: self, options: nil)[0] as! CustomInfoWindow
//customization code for the infoWindow
.......
return infoWindow
}
When my data model changes I call
mapView.clear()
and I add the new markers
If I use marker clusterer
Will I be able to add GMSMarker objects to the clusterer. Can they have custom icons (per marker) and custom info windows?
Will I be able to clear all markers from the clusterer and add new ones (when I get new data from my backend)?
Thanks in advance for any help / advice
Hi,
I was thinking about a feature of info window which will be visible when tap on any annotation/marker. This feature already exist in Android version of Google map utils. Please suggest if it is yet to implement or we can use this feature in existing code.
Thanks
I get this error :
NSAssert(itemToClusterDistanceMap.count == _items.count,
@"All items should be mapped to a distance");
in line 168 at GMUNonHierarchicalDistanceBasedAlgorithm.m
file
Debug helpers :
_items contain 2 elements
itemToClusterDistanceMap contain 1 key
debug of for loop
at line 133 :
processedItems
array.if ([processedItems containsObject:item]) continue;
which return true because second item was add at first execution.Hi there. I have implemented the clustering on my app but the CPU usage has gone pretty bad. I get sometimes 130% for just scrolling. I have something like 100 markers but even when I zoom in to just a few I still get high CPU usage which does not happening if I remove the clustering at all. I am clustering everytime the user moves the map a bit (maybe there is a better way of doing it?)
Hi,
I've added two folders "Clustering and QuadTree" from Google-Maps-Utils library to integrate marker clustering but its not showing clusters.
Below is my code-
class ViewController: UIViewController,GMSMapViewDelegate,GMUClusterManagerDelegate{
@IBOutlet var gmsMapView: GMSMapView!
let kClusterItemCount = 10000
let kCameraLatitude = -33.8
let kCameraLongitude = 151.2
private var clusterManager: GMUClusterManager!
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
let camera = GMSCameraPosition.cameraWithLatitude(kCameraLatitude,
longitude: kCameraLongitude, zoom: 10)
gmsMapView = GMSMapView.mapWithFrame(CGRect.zero, camera: camera)
// Set up the cluster manager with default icon generator and renderer.
let iconGenerator = GMUDefaultClusterIconGenerator()
let algorithm = GMUNonHierarchicalDistanceBasedAlgorithm()
let renderer = GMUDefaultClusterRenderer(mapView: gmsMapView, clusterIconGenerator: iconGenerator)
clusterManager = GMUClusterManager(map: gmsMapView, algorithm: algorithm, renderer: renderer)
generateClusterItems()
// Call cluster() after items have been added to perform the clustering and rendering on map.
clusterManager.cluster()
// Register self to listen to both GMUClusterManagerDelegate and GMSMapViewDelegate events.
clusterManager.setDelegate(self, mapDelegate: self)
}
// MARK: - GMUClusterManagerDelegate
func clusterManager(clusterManager: GMUClusterManager, didTapCluster cluster: GMUCluster) {
let newCamera = GMSCameraPosition.cameraWithTarget(cluster.position,
zoom: gmsMapView.camera.zoom + 1)
let update = GMSCameraUpdate.setCamera(newCamera)
gmsMapView.moveCamera(update)
}
// MARK: - GMUMapViewDelegate
func mapView(mapView: GMSMapView, didTapMarker marker: GMSMarker) -> Bool {
if let poiItem = marker.userData as? Spot {
NSLog("Did tap marker for cluster item \(poiItem.marker.title)")
} else {
NSLog("Did tap a normal marker")
}
return false
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
// MARK: - Private
/// Randomly generates cluster items within some extent of the camera and adds them to the
/// cluster manager.
private func generateClusterItems() {
dispatch_async(dispatch_get_main_queue()) {
if(self.gmsMapView != nil){
let extent = 0.2
for index in 1...self.kClusterItemCount {
let marker:GMSMarker = GMSMarker()
marker.title = "marker"
let lat = self.kCameraLatitude + extent * self.randomScale()
let lng = self.kCameraLongitude + extent * self.randomScale()
marker.position = CLLocationCoordinate2DMake(lat, lng)
marker.snippet = "1234"
marker.icon = self.generateSpot(index)
let spotObje:Spot = Spot()
spotObje.location = marker.position
spotObje.marker = marker
spotObje.marker.map = self.gmsMapView
self.clusterManager.addItem(spotObje)
}
}
}
}
func generateSpot(count:Int) -> UIImage{
let sizeVar:CGSize = CGSize(width: 41, height: 37)
let customeMarker :CustomMarker = NSBundle.mainBundle().loadNibNamed("customview", owner: self.view, options: nil).first! as! CustomMarker
customeMarker.frame = CGRectMake(customeMarker.frame.minX,customeMarker.frame.minY,customeMarker.frame.width,customeMarker.frame.height)
customeMarker.mappedNumbers.layer.masksToBounds = true
customeMarker.mappedNumbers.layer.cornerRadius = 8
customeMarker.mappedNumbers.text = String(count)
UIGraphicsBeginImageContextWithOptions(sizeVar, false, 0)
customeMarker.layer.renderInContext(UIGraphicsGetCurrentContext()!)
/// customeMarker.drawViewHierarchyInRect(customeMarker.bounds, afterScreenUpdates: true)
let newImage = UIGraphicsGetImageFromCurrentImageContext()
UIGraphicsEndImageContext()
return newImage
}
/// Returns a random value between -1.0 and 1.0.
private func randomScale() -> Double {
return Double(arc4random()) / Double(UINT32_MAX) * 2.0 - 1.0
}
}
//Spot.h
@import CoreLocation;
@interface Spot : NSObject
@Property (nonatomic) CLLocationCoordinate2D location;
@Property (nonatomic, strong) GMSMarker *marker;
Hi DDRBoxman, I noticed that the counting in GstaticCluster.m is not right, I was thinking maybe it's just in my app but the demo got the same too. If you are zooming down with differents steps for the zoom you can see that the global counting does not stay the same. I am trying to find out the problem but I did not find anything for the moment.
How to updated cluster Items after adding them without need for removing then re-adding them ?
When i try show infowindow, i be using the method:
(BOOL)mapView:(GMSMapView *)mapView didTapMarker:(GMSMarker *)marker {
_mapView.selectedMarker = marker;
return YES;
}
But this not show nothing.
In debug i can add the title label and snippet, like imagem below:
But when method mapView:didTapMarker is called, this receive a marker only position, without the title and snippet, like image below:
How can show Infowindow?
I was wondering if a native Swift code base is in the works as I would like to use Swift code only in my app and Swift is the way to go in the long run. Just wondering if that is on the road map currently. Thanks!
Currently DevApp does not compile with the new pod structure of GoogleMaps 2.0
I am trying to use Google-Maps-iOS-Utils in my project through Podfile where I use use_fameworks!.
It's giving error because GoogleMaps is static. Then I tried to copy Google-Maps-iOS-Utils manually and install only GoogleMaps from Podfiles. I am getting below error after that,
Undefined symbols for architecture x86_64:
"OBJC_CLASS$_GMUClusterManager", referenced from:
type metadata accessor for __ObjC.GMUClusterManager in ViewController.o
"OBJC_CLASS$_GMUDefaultClusterIconGenerator", referenced from:
type metadata accessor for __ObjC.GMUDefaultClusterIconGenerator in ViewController.o
"OBJC_CLASS$_GMUDefaultClusterRenderer", referenced from:
type metadata accessor for __ObjC.GMUDefaultClusterRenderer in ViewController.o
"OBJC_CLASS$_GMUNonHierarchicalDistanceBasedAlgorithm", referenced from:
type metadata accessor for __ObjC.GMUNonHierarchicalDistanceBasedAlgorithm in ViewController.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
This is a very serious problem and I am stuck here. Dropping use_frameworks! is not an option for me. I do not know if I have I added Google-Maps-iOS-Utils correctly. I need a serious help here.
Thanks.
I am developing an app that show users in nearby area in the maps. I use cluster manager to cluster users. The users/cluster items are updated periodically from server. Steps are :
But sometimes I got error : Collection was mutated while being enumerated
in GMUNonHierarchicalDistanceBasedAlgorithm.m
, particularly in this place :
/**
* Returns the set of clusters of the added items.
*/
- (NSArray<id<GMUCluster>> *)clustersAtZoom:(float)zoom {
NSMutableArray<id<GMUCluster>> *clusters = [[NSMutableArray alloc] init];
NSMutableDictionary<GMUWrappingDictionaryKey *, id<GMUCluster>> *itemToClusterMap =
[[NSMutableDictionary alloc] init];
NSMutableDictionary<GMUWrappingDictionaryKey *, NSNumber *> *itemToClusterDistanceMap =
[[NSMutableDictionary alloc] init];
NSMutableSet<id<GMUClusterItem>> *processedItems = [[NSMutableSet alloc] init];
for (id<GMUClusterItem> item in _items) { <--- HERE
....
Any advice how to prevent this error from occurring?
is still called when zoomed.
I followed the steps in Swift.md to manually add Google-Maps-iOS-Utils files to my project. And it succeeded in building. But when I try to get a view controller implement GMUClusterManagerDelegate, an error shows
Use of undeclared type 'GMUClusterManagerDelegate'
Here are my screen shots -
Can anyone help me with this? Thanks a lot!
I had use google map android utils geojson, it is great! However, where is geojson utils on ios? I can't find it, the current ios utils only has cluster.
please i need a full example to use custom markers "GMSMarker" with clustering , i'm not familar with objective c , i already tried to use #21 but it doesn't work for me , please help!!
I want to show window info when click cluster like when click maker, but how i don't know implement. Please, help me.
source 'https://github.com/CocoaPods/Specs.git'
target 'SwiftDemoApp' do
#use_frameworks!
pod 'GoogleMaps'
pod 'Google-Maps-iOS-Utils', '~> 1.0'
end
This is pod file code but still i get same error "Unable to find a specification for Google-Maps-iOS-Utils (~> 1.0)
"
I reinstall cocoapod then also i get this type of error
My queston is pretty simple. I wnat to know if the google-map-ios-util can block to scroll outside a given bounding box?
Thanks
We need to specify "use_frameworks!" in our podfile since we have swift pods. However we get the following error with cocoapods 1.0.1 when including the Google Maps Utils pod:
use_frameworks!
pod 'GoogleMaps'
pod 'Google-Maps-iOS-Utils'
ERROR:
target has transitive dependencies that include static binaries: (/Users/jeff/Documents/Clients/IGS/Projects/Choice360Connect/Pods/GoogleMaps/Subspecs/Base/Frameworks/GoogleMapsBase.framework, /Users/jeff/Documents/Clients/IGS/Projects/Choice360Connect/Pods/GoogleMaps/Subspecs/Maps/Frameworks/GoogleMapsCore.framework, and /Users/jeff/Documents/Clients/IGS/Projects/Choice360Connect/Pods/GoogleMaps/Subspecs/Maps/Frameworks/GoogleMaps.framework)
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?
Trying to perform pod install
in the Obj-C sample project throws this error.
Temporarily solved it by changing the podfile to
source 'https://github.com/CocoaPods/Specs.git'
target 'ObjCDemoApp' do
pod 'GoogleMaps'
#pod 'Google-Maps-iOS-Utils'
pod 'Google-Maps-iOS-Utils', :git => 'https://github.com/googlemaps/google-maps-ios-utils'
end
Why there is no heat map utility for iOS like Android? Or is it there and I could not find it!
Is there a way to change icon and title of individual markers when they are not clustered? For Android, I know I can extend DefaultClusterRenderer and override onBeforeClusterItemRendered method, but I cannot find a way to do this for iOS
I'm trying to get the info window to show when a marker is tapped.
In didTapMarker
I set the title manually with marker.title = "THE TITLE"
Nothing is shown.
It works if I add the markers directly like this:
let marker = GMSMarker(position: initialPosition) marker.map = self.mapView
but not when I add it via the cluster.
Any suggestions?
When I do pod install
I get
[!] The 'Pods-test' target has transitive dependencies that include static binaries: (/Users/user/Documents/test/Pods/GoogleMaps/Subspecs/Base/Frameworks/GoogleMapsBase.framework, /Users/user/Documents/test/Pods/GoogleMaps/Subspecs/Maps/Frameworks/GoogleMapsCore.framework, and /Users/user/Documents/test/Pods/GoogleMaps/Subspecs/Maps/Frameworks/GoogleMaps.framework)
I need to use use_frameworks!
in my Podfile, since I have swift pods as well.
Any suggestions?
Hello,
Is there an updated version for the latest Swift 3 update?
Hi,
I've added two folders "Clustering and QuadTree" manually from Google-Maps-Utils library to integrate marker clustering but its not showing clusters.
And also added required bridging-header.
I want to add marker and cluster based on users current location, markers are working, but unable to get cluster working.
Below is my code-
`import UIKit
import Alamofire
import SwiftyJSON
import CoreLocation
import GoogleMaps
/// Point of Interest Item which implements the GMUClusterItem protocol. COdE FROM GOOGLE SAMPLE PROJECT
class POIItem: NSObject, GMUClusterItem {
var position: CLLocationCoordinate2D
var name: String!
init(position: CLLocationCoordinate2D, name: String) {
self.position = position
self.name = name
}
}
let kClusterItemCount = 10000
let kCameraLatitude = -33.8
let kCameraLongitude = 151.2
class SearchTab: UIViewController ,GMSMapViewDelegate ,CLLocationManagerDelegate ,GMUClusterManagerDelegate{
var tapId = Int()
var getParams :Dictionary<String, String> = [String: String]() // DECLARING DICTIONARY FOR POST PARAMETERS
var params :[[String: AnyObject]] = [[:]] // DECLARING DICTIONARY FOR Result PARAMETERS
var searchCount = Int()
var locationManager = CLLocationManager()
var lati = Double()
var long = Double()
var boundArray = [CLLocationCoordinate2D]()
var mapview = GMSMapView()
var clusterManager: GMUClusterManager!
@IBOutlet weak var mapView: UIView!
override func viewDidLoad() {
super.viewDidLoad()
//DELEGATES MAP AND LOCATION MANAGER
mapview.delegate = self
self.locationManager.delegate = self
self.locationManager.desiredAccuracy = kCLLocationAccuracyBest
self.locationManager.requestWhenInUseAuthorization()
self.locationManager.requestLocation()
// Set up the cluster manager with default icon generator and renderer.
let iconGenerator = GMUDefaultClusterIconGenerator()
let algorithm = GMUNonHierarchicalDistanceBasedAlgorithm()
let renderer = GMUDefaultClusterRenderer(mapView: mapview, clusterIconGenerator: iconGenerator)
clusterManager = GMUClusterManager(map: mapview, algorithm: algorithm, renderer: renderer)
// Register self to listen to both GMUClusterManagerDelegate and GMSMapViewDelegate events.
clusterManager.setDelegate(self, mapDelegate: self)
}
// MARK: - GMUClusterManagerDelegate
func clusterManager(clusterManager: GMUClusterManager, didTapCluster cluster: GMUCluster) {
let newCamera = GMSCameraPosition.cameraWithTarget(cluster.position,
zoom: mapview.camera.zoom + 1)
let update = GMSCameraUpdate.setCamera(newCamera)
mapview.moveCamera(update)
}
/// Returns a random value between -1.0 and 1.0.
private func randomScale() -> Double {
return Double(arc4random()) / Double(UINT32_MAX) * 2.0 - 1.0
}
func locationManager(manager: CLLocationManager, didUpdateLocations locations: [CLLocation])
{
let location = locations.first
self.locationManager.stopUpdatingLocation()
getParams["lat"] = location?.coordinate.latitude
getParams[lon"] = location?.coordinate.longitude
setupMap()
}
func locationManager(manager: CLLocationManager, didFailWithError error: NSError)
{
print("Errors: " + error.localizedDescription)
}
//Mark-- setup location on map using the users current location
func setupMap(){
let lat :Double = Double(getParams["lat"]!)
let long = Double(getParams["lon"]!)
let camera = GMSCameraPosition.cameraWithLatitude(lat , longitude: long, zoom: 10.0)
let userLocation = CLLocationCoordinate2D(latitude: lat, longitude: long)
let userCam = GMSCameraUpdate.setTarget(userLocation)
mapview = GMSMapView(frame: self.mapView.bounds)
mapview.myLocationEnabled = true
mapview.settings.myLocationButton = true
mapview.delegate = self
mapview.camera = camera
self.lati = lat
self.long = long
self.getParams = [:]
self.getParams["lat"] = "\(lat)"
self.getParams["lng"] = "\(long)"
self.mapView.addSubview(mapview)
//CALLING FUNCTION TI SEARCH Required results near the users current location
gpsSearch()
}
//MARK -- LOCAtion BASED SEARCH
func gpsSearch() {
LoadingOverlay.shared.showOverlay((self.navigationController?.view)!)
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0)) {
dispatch_async(dispatch_get_main_queue()) {
self.getParams["miles"] = "5"
Alamofire.request(.POST, "MY SEARCH URL", parameters: self.getParams, encoding:.JSON).responseJSON
{
response in switch response.result
{
case .Success(let res):
// print(res)
let userData = JSON(res)
if userData["error"] != "false"{
print(userData["error"])
self.displayALert("Aw snap! No results found. Give us another shot")
LoadingOverlay.shared.hideOverlayView()
return
}
self.params = res["result"] as! [[String:AnyObject]]
print("THESE ARE Marker RESULTS COUNT-- \(self.params.count)")
var count = 0
for result in self.params{
// print("--------- \(result)")
let marker = GMSMarker()
marker.icon = UIImage(named: "annotImage")
marker.infoWindowAnchor = CGPointMake(0,0)
marker.accessibilityLabel = "\(count)"
marker.position = CLLocationCoordinate2DMake(result["lat"]!.doubleValue , result["lng"]!.doubleValue)
marker.map = self.mapview
count += 1
let cor = marker.position
self.boundArray.append(cor)
}
let location = CLLocationCoordinate2D(latitude: self.lati , longitude: self.long)
self.boundArray.append(location)//["coordinate"] = location
let lastLoc = CLLocationCoordinate2D(latitude: self.params[count - 1]["lat"]!.doubleValue , longitude: self.params[count - 1]["lng"]!.doubleValue)
let bounds = GMSCoordinateBounds(coordinate: location, coordinate: lastLoc)
let camera = self.mapview.cameraForBounds(bounds, insets: UIEdgeInsets())!
self.mapview.camera = camera
let zoomCamera = GMSCameraUpdate.zoomOut()
self.mapview.animateWithCameraUpdate(zoomCamera)
var clustItem = 0
let extent = 0.2
for result in self.params{
// print("--------- (result)")
let lat = result["lat"]!.doubleValue + extent * self.randomScale()
let lng = result["lng"]!.doubleValue + extent * self.randomScale()
let name = "Item (clustItem)"
let item = POIItem(position: CLLocationCoordinate2DMake(lat, lng), name: name)
clustItem += 1
self.clusterManager.addItem(item)
}
self.clusterManager.cluster()
LoadingOverlay.shared.hideOverlayView()
case .Failure(let error):
LoadingOverlay.shared.hideOverlayView()
self.displayALert("Something went wrong, please try again")
print("Request failed with error: \(error)")
}
}
}}
}
//MARK: GMSMapViewDelegate
func mapView(mapView: GMSMapView!, markerInfoWindow marker: GMSMarker!) -> UIView! {
// Get a reference for the custom overlay
let index:Int! = Int(marker.accessibilityLabel!)
let customInfoWindow = NSBundle.mainBundle().loadNibNamed("CustomInfoWindow", owner: self, options: nil)[0] as! CustomInfoWindow
customInfoWindow.title.text = self.params[index]["name"] as! String
customInfoWindow.subTitle.text = self.params[index]["address"] as! String
customInfoWindow.backgroundColor = UIColor.blackColor()
customInfoWindow.alpha = 0.7
customInfoWindow.layer.cornerRadius = 5
customInfoWindow.title.textColor = UIColor.whiteColor()
customInfoWindow.subTitle.textColor = UIColor.whiteColor()
//
let vancouver = CLLocationCoordinate2D(latitude: self.params[index]["lat"]!.doubleValue, longitude: self.params[index]["lng"]!.doubleValue)
let vancouverCam = GMSCameraUpdate.setTarget(vancouver)
mapview.animateWithCameraUpdate(vancouverCam)
return customInfoWindow
}
//MARK :- FUNCTION TO DETECT tap on Infowindow of map
func mapView(mapView: GMSMapView, didTapInfoWindowOfMarker marker: GMSMarker) {
// print("Tapp detected")
let index:Int! = Int(marker.accessibilityLabel!)
tapId = self.params[index]["winery_id"] as! Int
print("Tapp detected---- win id \(tapId)")
}
func displayALert(userMessage:String){ //FUNCTION FOR DISPLAYING ALERT ON EMPTY FIELDS
let alertController:UIAlertController = UIAlertController(title: "Alert", message:
userMessage, preferredStyle: UIAlertControllerStyle.Alert)
alertController.addAction(UIAlertAction(title: "Ok", style: UIAlertActionStyle.Default,handler: nil))
self.presentViewController(alertController, animated: true, completion: nil)
} //END OF DISPLAY ALERT FUN
}
`
The app builds and runs ,but clusters are not not getting displayed, please help
When the app start, show total of 253 marks in one circle, apparently fine. After zoo in, not show separated markers.
My _mapView is instantiated from a UIView.
In Xcode, not show issues or warnings. In console not show error.
iOS 8
Google Maps Version: Google Maps SDK for iOS version: 1.9.13516.0
I will do more tests, but if someone can help, I will be very grateful!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.