4

Im using GMS (Google Maps SDK) In my current project, and it looks like this

Is it possible to style the map to something like this? and still use GMS.

Victor
  • 1,603
  • 4
  • 17
  • 24

2 Answers2

9

You can customize the map the way you want here: https://mapstyle.withgoogle.com/

Once you are done with customization, copy the json and add it your project in a file say style.json

Then assign this styling to your map as:

do {
            // Set the map style by passing the URL of the local file.
            if let styleURL = Bundle.main.url(forResource: "style", withExtension: "json") {
                mapView.mapStyle = try GMSMapStyle(contentsOfFileURL: styleURL)

            } else {
                NSLog("Unable to find style.json")
            }
        } catch {
            NSLog("One or more of the map styles failed to load. \(error)")
        } 
Zarif Ahmed
  • 343
  • 2
  • 9
0

You must use custom tiles:

class TestTileLayer: GMSSyncTileLayer {
 override func tileForX(x: UInt, y: UInt, zoom: UInt) -> UIImage? {
    // On every odd tile, render an image.
    let image = "\(x)-\(y)-\(zoom)"
    return UIImage(named: image)
  }
}

the tiles can come from a server with an http request or from your bundle. Basically a tile is an image which show a piece of map at x - z with a zoom.

usage:

let layer = TestTileLayer()
layer.map = mapView
Marco Santarossa
  • 4,058
  • 1
  • 29
  • 49