So, I have a google map that's declared in an IBOutlet
@IBOutlet weak var mapView: GMSMapView!
I create my GMSSyncTileLayer in the idleAtCameraPosition function like this
func mapView(mapView: GMSMapView!, idleAtCameraPosition position: GMSCameraPosition!) {
var layer = TestTileLayer()
layer.map = mapView
}
And this is my GMSSyncTileLayer
class TestTileLayer: GMSSyncTileLayer {
//MainActivityX() is the name of the View Controller my GMSMapView is in ^
let mainActivity = MainActivityX()
override func tileForX(x: UInt, y: UInt, zoom: UInt) -> UIImage! {
NSLog("X: \(x)")
NSLog("Y: \(y)")
//This is nil :(
NSLog("mapView: \(mainActivity.mapView)")
var boost:Float = 1.00
if let heatmap: UIImage = LFHeatMap.heatMapForMapView(mainActivity.mapView, boost:boost, locations:locations as[AnyObject]) {
NSLog("heatmap")
return heatmap
}
else {
NSLog("kGMSTileLayerNoTile")
return kGMSTileLayerNoTile
}
}
This is an excerpt from my logs --
2015-06-07 22:18:15.586 Hightide[7011:2387342] Y: 3133
2015-06-07 22:18:15.586 Hightide[7011:2387342] mapView: nil
2015-06-07 22:18:15.587 Hightide[7011:2387344] kGMSTileLayerNoTile
2015-06-07 22:18:15.587 Hightide[7011:2387344] X: 2339
My mapView is nil :(
Can someone please show my how I can pass in my mapView to this GMSSyncTileLayer.
Or show me how I can use x and y to to get the equivalent of 'mapView.projection' ? Because that's what I really need from the mapView anyway.
Also these x and y values do not make any sense to me...
And although I read the docs on Tile Layers
^This doesn't make sense based on the values I'm getting for X and Y
2015-06-07 22:18:15.586 Hightide[7011:2387342] Y: 3133 ???
2015-06-07 22:18:15.587 Hightide[7011:2387344] X: 2339 ???
I still have a hard time understanding what these x and y values are representing. When I'm all the way zoomed out they go to zero, when I'm zooming in they go higher and higher. I know this...But do not understand the meaning of the values.
Am I literally at coordinate (2339,3133) ? Is it in the center of my map? What am I looking at here?
Thanks!