Mazel Tov
Mazel Tov

Reputation: 2182

iOS Google Maps SDK - Hide / remove labels

I am using Google Maps SDK in my iOS project. I am using Swift and I want to display the Google Map in UIView without any text or labels. I am able to display the map correctly but I am not able to remove the text from the map... I saw the same problem in Javascript but was unable to replicate it in Swift (How to get a map without labels?)... I want the regular type of the map (kGMSTypeNormal). Is there some way how to do it?

Upvotes: 1

Views: 3159

Answers (2)

TheTiger
TheTiger

Reputation: 13354

Its possible to hide the labels, landmarks and roads.

do {
     // Set the map style by passing the URL of the local file.
     if let styleURL = Bundle.main.url(forResource: "mapStyle", withExtension: "json") {
           self.mapView.mapStyle = try GMSMapStyle(contentsOfFileURL: styleURL)
      } else {
           print("Unable to find style.json")
      }
   } catch {
       print("One or more of the map styles failed to load. \(error)")
  }

Where mapStyle.json is a json file in my project. For more detail see Google documentation.

Upvotes: 4

ReyAnthonyRenacia
ReyAnthonyRenacia

Reputation: 17613

It seems there is no direct answer for this feature yet. I can only think of 2 possible options namely:

  1. Use Satellite view. It has no labels/texts whatsoever.

    mapView.mapType = kGMSTypeSatellite;

  2. Use Custom Tile Overlays/Layers

Tile layers (sometimes referred to as Tile Overlays) allow you to superimpose images on top of Google's base map tiles. This is an excellent way to add data - such as points of interest or traffic information - and local imagery to your app. When combined with the kGMSTypeNone map type, tile layers effectively let you replace Google's base map data with your own.

Upvotes: 2

Related Questions