Question

I need to have the possibilty to switch a map view from Apple's MapKit (>= iOS6) to the Google Maps API and back in realtime. In the maps there are a lots of annotations that need to be clustered. Now I'm thinking about the best way to da this. I think the clustering can be done indepentenly. The main question is, how to change the map itself.

It's my understanding that Apple Maps and the Google Maps SDK are completely different systems that have to be treated separately.

But then there is ClassicMaps, a free project an github, that makes it possible to switch the maps. How do they do this? Is this allowed?

Is there another way to approach this problem?

Many thanks in advance

Was it helpful?

Solution

We wanted to switch between MapKit and GMS too. So we started out with: MapKit first because the MKAnnotations / MKAnnotationViews already 'allow for one level of indirection' more than the Google GMSMarker objects.

We THEN wrote a custom GoogleMapsMapView -- a UIView that HAS a GMSMapView as subview and mimics all of MKMapView and also calls the MKMapViewDelegate.

After we verified that the new GoogleMapsMapView components works and looks like a MKMapView, we made a new class (again :D) .. e.g. CommonMapview that - on alloc/init - gives you back the correct class for your OS.. either a MKMapView or a GoogleMapsMapView

the Clusting you mentioned is implemented in the CommonMapView and is completely unaware of the renderer

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top