iOS Google Maps Api Tiled Overlays - ios

My app currently is using the google maps api v2 for iOS. I would like to add custom tiled overlays, which I realize is not support by the api.
The first approach I took to this problem was to try to extend the GMSOverlay class but I later found that the drawLayer method was never being called.
Next, I tried having my custom class extend UIView and then add my class as a subview to the map view. I was able to use the GMSMapViewDelegate method didChangeCameraPosition to report camera updates back to my custom class so that the tiles could be redrawn. This mostly worked with a couple exceptions, first, only the initial set of tiles would load, and if you panned or zoomed from the initial X,Y,Z the map tiles would not update via the drawInRect method. The second problem was that my custom UIView was covering all the markers and their corresponding callouts after tapping.
My question is, does anyone having any experience adding custom tiles or subclassing the GMSOverlay class to add, for example, custom weather tiles over top of the google map?

Good news from the release notes of v. 1.3.0 of Google Maps SDK for iOS (released today):
Support for custom tile overlays (image-based) via GMSTileLayer.
See: https://developers.google.com/maps/documentation/ios/releases

Have you tried looking at this example?
https://github.com/mtigas/iOS-MapLayerDemo
It is based on the MKMapKit, not the Google-Map SDK. It supports tiles with zoom and is very easy to extend, and might point you in the right direction.
If you need to generate tiles for the map, you can use MapTiler
http://www.maptiler.org/
The Windows version of MapTiler gives more fine grained control of the tile generation.

Related

Using MKMapView with a custom MKOverlay. Can the local attractions that come with Apple Maps by default appear above the overlay layer?

I have an MKMapView with an MKOverlay on top, I'm wondering if its possible to have road names, place names, places of interest and everything like that, that comes by default with Apple Maps, can be displayed above my MKMapView so I don't have to add all this information manually as annotations. I know this is possible with the Google Maps API on Android so wasn't sure if I could do this with Apple Maps.
I've added an image that shows iOS versus Android to show what I am envisioning:
So, I've found a solution to this issue. If you're using the addOverlay: method in MKMapView, you can use:
[self.myMapView addOverlay:customOverlay level:MKOverlayLevelAboveRoads];
MKOverlayLevelAboveRoads means place labels including shields and point of interest icons are shown above your overlay.
MKOverlayLevelAboveLabels means your overlay will appear on top of everything (which i believe is the default based on my experiences).

Add text under markers in mapbox ios

I'm using Mapbox SDK in my iOS app (using Swift).
I want a label to show under every marker like this:
I couldn't find anywhere in the docs or on stackoverflow how I can achieve that. I tried to make the text a part of the marker image, but the text does not resize itself that way and things are a mess when markers are close (or when you zoom out).
Does anybody know how I can make that happen?
Right now, you'll want to do this at the GL style level using Mapbox Studio — not as dynamic annotations.
Doing it in the style allows labels to be recalculated and customized based on the surrounding data and map state, whereas annotations currently aren't as customizable.

Is there any way to synchronize the Map Vector (OpenGL layer) and UIKit?

Say you have a fixed pin in the middle of the screen using an UIImageView on top of the GMSMapView. At some point in the flow I need to remove the fixed pin and add it as a marker in the map.
One could do so by setting the fixed pin hidden property to true and then adding a GMSMarker in the center of the map using the same asset as the UIImageView. That works except that there is a visual glitch since adding the marker touches the OpenGL layer whether hiding the pin uses UIKit.
Is there any way to synchronize these two operations?
Not really. See this question for a discussion on OpenGL-UIKit syncing — the conclusion is that Apple has access to the private CAEAGLLayer.synchronized and nobody else does.
This is part of the reason why Google limits their SDK map views to 30fps, I'd imagine. Developing on top of a third-party SDK especially limits your syncing possibilities, as you have no/extremely-limited access to GLKView, CAEAGLLayer, or EAGLContext.
I'd suggest investigating Mapbox GL for iOS if you're looking for more wiggle-room and openness. See this issue about ongoing efforts to improve inter-layer view syncing.

iOS Custom InfoWindow Google Maps SDK 1.7.2

I have been searching and coding with the Google Maps iOS SDK 1.7.2
I need to build an app that displays custom InfoWindow after the marker is tapped.
Google posted a YouTube Video, that shows how to do it with just ONE marker.
The practical use scenario uses more than ONE marker, but if we follow the example of YouTube Video adding more than one marker, all the markers would show the same info inside the custom InfoWindows.
I did a iOS sample and uploaded to GitHub Sample Here
My Question is: Could anyone download the sample at GitHub and help me to implement that feature, display more than one marker with custom InfoWindow displaying different info for each marker ? In my sample inside the InfoWindow there is a WebView. For my use scenario I would need to load for each marker a different WebView(url) for each marker on the map but I couldn't load the WebView inside the custom InfoWindow. That WebView would be the size of the custom InfoWindow.I would load all the info for the markers as different webpages in the size of the info window.
It also would help a lot of other people that right now can't find a complete and fully working sample of that custom InfoWindow for iOS.
Thanks and Cheers!
Another vote for SMCalloutView. Check out my answer here for a quick start on implementing it.
Sorry to not actually answer your question per se, but Google's rendered UIView info windows are more hassle than they're worth, I think. You may be able to get a webview to load inside one of them, but the Maps SDK takes the custom UIView you set and then renders it into OpenGL, ignoring most (all?) updates you try to make.
Using SMCalloutView skips all of that and we put its view on top of the map, allowing you better control before and after drawing.
SMCalloutView helps you to custom the InfoWindow, you can download the Sample project and run it.
For displaying multiple InfoWindows, you have to treat GoogleMaps SDK (GMSMapView has a #property(nonatomic, strong) GMSMarker *selectedMarker property, which is not a Set), see the Sample project, in mapView:didTapAtMarker: delegate method.

MKMapView rotation

Apple's latest Maps application allows a user to rotate a map. How can I add this functionality to my MKMapView? I presumed it'd just be a case of setting a boolean property (similar to zoomEnabled), but I can't find anything relevant in the documentation.
There is no built-in rotation support in the MapKit of iOS. You could use regular view transforms (but than all street names etc. will also be rotated of course), or you use the Google Maps SDK or MapBox or something else.
The Google Maps SDK does support rotation, even 3D rotation. The SDK Download includes an example project showcasing the functionality.
Actually MKMapView does support map rotation starting with iOS 5.0. Either you use the MKUserTrackingBarButtonItem control in your toolbar (user taps it until the map is rotating), or you set the userTrackingMode property to MKUserTrackingModeFollowWithHeading.

Resources