Get Started
This guide walks you through installing the GLOBUS SDK and displaying your first map on iOS or Android.
What You'll Build
By the end of this guide, you'll have:
- ✅ GLOBUS SDK installed in your project
- ✅ A working map view displaying OpenStreetMap data
- ✅ Basic camera controls (zoom, pan)
Time to complete: ~10 minutes
Prerequisites
- iOS: Xcode 14+, iOS 13.0+ target
- macOS: Xcode 14+, macOS 11.0+ target
- Android: Android Studio, API level 21+ (Android 5.0+)
- API Key: Create a free API key or contact [email protected]
Choose Your Platform
Select your platform to get started:
📱 iOS (Swift)
Step 1: Install the SDK
GLOBUS supports Swift Package Manager (recommended) and CocoaPods.
Option A: Swift Package Manager
- In Xcode, select File → Add Packages
- Enter the repository URL:
https://github.com/GLMap/GLMapSwift - Select Up to Next Major Version with
1.0.0 - Click Add Package
- Select the packages you need:
- GLMap (required) – Map rendering
- GLMapSwift (recommended) – Swift extensions
- GLRoute (optional) – Navigation
- GLSearch (optional) – Offline search
Option B: CocoaPods
Add to your Podfile:
platform :ios, '13.0'
use_frameworks!
target 'YourApp' do
pod 'GLMap'
pod 'GLRoute' # Optional: for routing
pod 'GLSearch' # Optional: for search
end
Run:
pod repo update
pod install
Open the .xcworkspace file (not .xcodeproj).
Step 2: Initialize the SDK
In your AppDelegate.swift, import GLMap and activate it with your API key:
import UIKit
import GLMap
import GLMapSwift
@main
class AppDelegate: UIResponder, UIApplicationDelegate {
func application(_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Activate GLMap with your API key
GLMapManager.activate(apiKey: "YOUR_API_KEY")
return true
}
}
Step 3: Add a Map View
In your view controller (e.g., ViewController.swift):
import UIKit
import GLMap
import GLMapSwift
class ViewController: UIViewController {
var mapView: GLMapView!
override func viewDidLoad() {
super.viewDidLoad()
// Create map view
mapView = GLMapView(frame: view.bounds)
mapView.autoresizingMask = [.flexibleWidth, .flexibleHeight]
view.addSubview(mapView)
// Set initial position (San Francisco)
mapView.mapGeoCenter = GLMapGeoPoint(lat: 37.7749, lon: -122.4194)
mapView.mapZoomLevel = 12
}
}
Step 4: Run Your App
Build and run! You should see a map centered on San Francisco.
Troubleshooting:
- "DefaultStyle.bundle not found": Ensure GLMap is properly linked. The style is embedded in the framework.
- Blank map: Check that your API key is valid and internet is available for initial tile download.
🤖 Android (Kotlin)
Step 1: Add Maven Repository
In your project's settings.gradle (or root build.gradle):
dependencyResolutionManagement {
repositories {
google()
mavenCentral()
maven { url 'https://maven.globus.software/artifactory/libs' }
}
}
Step 2: Add Dependencies
In your app's build.gradle:
dependencies {
implementation 'globus:glmap:1.12.0'
implementation 'globus:glroute:1.12.0' // Optional: for routing
implementation 'globus:glsearch:1.12.0' // Optional: for search
}
Sync your project.
Step 3: Initialize the SDK
Create an Application class:
import android.app.Application
import globus.glmap.GLMapManager
class MyApp : Application() {
override fun onCreate() {
super.onCreate()
// Initialize GLMap with your API key
GLMapManager.Initialize(this, "YOUR_API_KEY", null)
}
}
Register it in AndroidManifest.xml:
<application
android:name=".MyApp"
...>
Step 4: Add Map View to Layout
In your activity's layout (activity_main.xml):
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<globus.glmap.GLMapView
android:id="@+id/map_view"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</FrameLayout>
Step 5: Load the Map
In your MainActivity.kt:
import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import globus.glmap.GLMapView
import globus.glmap.MapPoint
class MainActivity : AppCompatActivity() {
private lateinit var mapView: GLMapView
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
mapView = findViewById(R.id.map_view)
// Set initial position (San Francisco)
mapView.renderer.setMapGeoCenter(MapGeoPoint(37.7749, -122.4194))
mapView.renderer.mapZoom = 12f
}
}
Step 6: Run Your App
Build and run! You should see a map centered on San Francisco.
Troubleshooting:
- Build errors: Ensure you've added the Maven repository correctly.
- "DefaultStyle.bundle not found": The style is embedded in the library; ensure GLMap is properly added as a dependency.
- Blank map: Check your API key and internet connectivity for initial tiles.
🍎 Objective-C (iOS)
Step 1: Install via CocoaPods
Add to your Podfile:
platform :ios, '13.0'
use_frameworks!
target 'YourApp' do
pod 'GLMap'
end
Run pod install.
Step 2: Initialize in AppDelegate
#import <GLMap/GLMap.h>
- (BOOL)application:(UIApplication *)application
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[GLMapManager activateWithApiKey:@"YOUR_API_KEY"];
return YES;
}
Step 3: Add Map View
#import <GLMap/GLMap.h>
@interface ViewController ()
@property (strong, nonatomic) GLMapView *mapView;
@end
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
self.mapView = [[GLMapView alloc] initWithFrame:self.view.bounds];
self.mapView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
[self.view addSubview:self.mapView];
self.mapView.mapGeoCenter = GLMapGeoPointMake(37.7749, -122.4194);
self.mapView.mapZoomLevel = 12;
}
@end
☕ Java (Android)
Step 1: Add Dependencies
See the Kotlin section above for Gradle setup.
Step 2: Initialize in Application Class
import android.app.Application;
import globus.glmap.GLMapManager;
public class MyApp extends Application {
@Override
public void onCreate() {
super.onCreate();
GLMapManager.Initialize(this, "YOUR_API_KEY", null);
}
}
Step 3: Add Map View
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import globus.glmap.GLMapView;
import globus.glmap.MapPoint;
public class MainActivity extends AppCompatActivity {
private GLMapView mapView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mapView = findViewById(R.id.map_view);
mapView.renderer.setMapGeoCenter(new MapGeoPoint(37.7749, -122.4194));
mapView.renderer.setMapZoom(12f);
}
}
Components Overview
GLOBUS consists of three main SDKs. Install only what you need:
| Component | Purpose | When to Use |
|---|---|---|
| GLMap | Map rendering | Required for all apps |
| GLRoute | Offline routing & navigation | Add if you need turn-by-turn directions |
| GLSearch | Offline search | Add if you need address/POI search |
GLMapSwift Extension
For iOS Swift projects, we recommend adding GLMapSwift – an open-source extension providing:
- Swift-friendly property wrappers
- Convenience methods
- Better type safety
What's Next?
Congratulations! You now have a working map in your app. Here's what to explore next:
Tutorials
- Display User Location – Show the user's current position on the map
- Add Markers & Pins – Display custom markers and handle tap events
Guides
- Custom Map Styling – Create your own map theme with MapCSS
Resources
- Demo Apps – 25+ working examples for iOS and Android
- API Reference – Complete API documentation
- MapCSS Reference – Styling language documentation
Need Help?
- 📧 Email: [email protected]
- 💬 Check our FAQ for common issues
- 🐛 Found a bug? Report it