Skip to main content

Get Started

Components Overview

The framework comprises three main components: GLMap, GLRoute, and GLSearch. Include only what your project needs.

For iOS, we've transitioned to exclusively use dynamic frameworks. Static versions are no longer available.

Additional Swift syntax enhancements are available through the GLMapSwift extension, open-source on GitHub: GLMapSwift Repository.

iOS

Add libraries

Swift Package Manager (SPM)

  1. Go to File -> Add Packages in Xcode
  2. Paste repo URL https://github.com/GLMap/GLMapSwift
  3. Choose the package and import.

Cocoapods

  • pod repo update
  • Add GLMap, GLRoute, GLSearch to Podfile
platform :ios, '12.0'
use_frameworks!
target 'TargetName' do
pod 'GLMap'
pod 'GLRoute' # if needed
pod 'GLSearch' # if needed
end
  • Run pod install
  • Open .xcworkspace

Carthage

Components are available as binary-only frameworks.

binary "https://user.getyourmap.com/downloads/free/GLMap.json"
binary "https://user.getyourmap.com/downloads/free/GLRoute.json" # if needed
binary "https://user.getyourmap.com/downloads/free/GLSearch.json" # if needed

Manually add resource dependencies. Check inside .json files or user cabinet for world map and default style.

Usage

Initialize GLMapManager in AppDelegate.swift and set API key.

import GLMap
import GLMapSwift

GLMapManager.activate(apiKey: <#API key#>)

Add GLMapView

let mapView = GLMapView(frame: self.view.bounds)
self.view.addSubview(mapView)

Show Current Location

To display the user's location using GLMapView, ensure that you set showUserLocation to true:

mapView.showUserLocation = true

Then you have two options:

  1. Create your own CLLocationManager instance and set GLMapView as its delegate.
let locationManager = CLLocationManager()
locationManager.delegate = mapView
  1. Forward -locationManager:didUpdateLocations: calls from your existing CLLocationManager delegate to GLMapView.
func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) {
mapView.locationManager(manager, didUpdateLocations: locations)
}

For detailed examples, refer to our Swift Demo App, Objective-C Demo App, and API Documentation.

Android

Maven

Easily add GLMap and its extensions to your project via Maven. Just pop these lines into your build.gradle:

repositories {
maven { url 'https://maven.globus.software/artifactory/libs' }
}
dependencies {
implementation'globus:glmap:1.7.4'
implementation'globus:glroute:1.7.4' // For navigation
implementation'globus:glsearch:1.7.4' // For search
}

Use GLMap from Java

Insert a GLMapView into your layout file and initialize GLMapManager with your API key:

public class YourApp extends Application {
@Override
public void onCreate() {
super.onCreate();
GLMapManager.Initialize(this, <API_KEY>, null);
// For search features, also initialize GLSearch
// GLSearch.Initialize(this);
}
}

Then, activate the map view in your activity and apply a style:

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
GLMapView mapView = findViewById(R.id.map_view);
mapView.loadStyle(getAssets(), "DefaultStyle.bundle");
}

Jump in and start building! For more insights, check out our Android Demo App and Android API Documentation.