Skip to main content

Your first map

Complete installation, activation, and style setup in Get started first.

Position the camera​

GLMap uses latitude first and longitude second.

Swift​

map.mapGeoCenter = GLMapGeoPoint(lat: 41.1579, lon: -8.6291)
map.mapZoomLevel = 12

Kotlin​

map.renderer.mapGeoCenter = MapGeoPoint(41.1579, -8.6291)
map.renderer.mapZoom = 12.0

mapGeoCenter is convenient for geographic coordinates. mapCenter uses GLMap's internal projected coordinates and is useful when fitting or animating map objects.

Enable online tiles deliberately​

Online tile downloading is an application policy and is disabled by default.

Swift​

GLMapManager.shared.tileDownloadingAllowed = true

Kotlin​

GLMapManager.SetTileDownloadingAllowed(true)

Leave this setting disabled when the application must use only embedded or downloaded maps.

Change the iOS style​

Create a new parser when style options change, then replace the map style:

let parser = GLMapStyleParser(paths: [stylePath, Bundle.main.bundlePath])
parser.setOptions(["Theme": "Dark"], defaultValue: true)
map.setStyle(try parser.parseFromResources())
map.reloadTiles()

Both iOS and Android load DefaultStyle.bundle when the map view is created. Use GLMapStyleParser only for a custom style or custom options.

See the complete map-display examples in SwiftDemo and kotlinDemo.