Documentation
Search…
Get Started
Just follow steps below to integrate GLMap framework into your application.

Functions and structure

To keep applications lightweight we divided framework to 3 major components: GLMap, GLRoute, GLSearch. No need to include navigation or search into your project if you don't use it.
On iOS to make application fast each component published as dynamic framework and as static library. Names of static pods is GLMapStatic, GLRouteStatic, GLSearchStatic. When linked with static library, linker is able to remove all unused code and optimize application even further.
Swift modules and Android native libraries is always compiled as dynamic libraries.
Some sytax sugar for Swift is added as GLMapSwift extension. It is open source and available on github: https://github.com/GLMap/GLMapSwift

iOS

Cocoapods

  • Run pod repo update to make CocoaPods aware of the latest available GLMap versions.
  • Add GLMap into your Podfile
Podfile
1
platform :ios, '8.0'
2
use_frameworks!
3
4
target 'TargetName' do
5
pod 'GLMap'
6
pod 'GLRoute' # if you need navgation
7
pod 'GLSearch' # if you need search
8
end
Copied!
  • Run pod install in project directory
  • Use the .xcworkspace file generated by CocoaPods to work on your project.

Carthage

All components is published in Carthage as binary-only frameworks.
To add it into your project just add binary dependency into your Cartfile
Cartfile
1
binary "https://user.getyourmap.com/downloads/free/GLMap.json"
2
binary "https://user.getyourmap.com/downloads/free/GLRoute.json" # if you need navigation
3
binary "https://user.getyourmap.com/downloads/free/GLSearch.json" # if you need search
Copied!
Unfortunately there is no way to add resource dependencies into Carhage, and you'll need to add them manually into your project.
GLMap requires world map and default style to work correctly. Download links to GLMapWorldMap and GLMapDefaultStyle you could find inside .json files and in user cabinet.
For convenience we published all releases info json files:
1
https://user.getyourmap.com/downloads/free/GLMap.json
2
https://user.getyourmap.com/downloads/free/GLMapStatic.json
3
https://user.getyourmap.com/downloads/free/GLRoute.json
4
https://user.getyourmap.com/downloads/free/GLRouteStatic.json
5
https://user.getyourmap.com/downloads/free/GLSearch.json
6
https://user.getyourmap.com/downloads/free/GLSearchStatic.json
7
https://user.getyourmap.com/downloads/free/GLMapDefaultStyle.json
8
https://user.getyourmap.com/downloads/free/GLMapWorldMap.json
Copied!

Use framework from Objective-C

Initialize GLMapManager inside AppDelegate. And set your API key from user cabinet.
AppDelegate.m
1
#import <GLMap/GLMap.h>
2
@implementation AppDelegate
3
4
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
5
[GLMapManager sharedManager].apiKey = <#API key#>;
6
return YES;
7
}
Copied!
Then add GLMapView into view hierarchy from code or using Interface Builder.
ViewController.m
1
#import <GLMap/GLMap.h>
2
3
@implementation ViewController
4
-(void)viewDidLoad {
5
GLMapView *mapView = [[GLMapView alloc] initWithFrame:self.view.bounds];
6
[self.view addSubview:mapView];
7
}
Copied!
Now you're ready to write your app with GLMap framework. Consider our Demo App as source of examples and code snippets.

Use framework from Swift

Initialize GLMapManager inside AppDelegate. And set your API key from user cabinet.
AppDelegate.swift
1
import GLMap
2
import GLMapSwift
3
4
@UIApplicationMain
5
class AppDelegate: UIResponder, UIApplicationDelegate {
6
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
7
GLMapManager.shared.apiKey = <#API key#>
8
return true
9
}
10
}
Copied!
Then add GLMapView into view hierarchy from code or using Interface Builder.
ViewController.swift
1
class ViewController: UIViewController {
2
override func viewDidLoad() {
3
super.viewDidLoad()
4
5
let mapView = GLMapView(frame: self.view.bounds)
6
self.view.addSubview(mapView)
7
}
8
}
Copied!
Now you're ready to write your app with GLMap framework. Consider our Demo App as source of examples and code snippets.

Android

Maven

Add repository and dependency into module level build.gradle file.
build.gradle
1
repositories {
2
// Any other repositories
3
maven { url 'https://maven.getyourmap.com/artifactory/libs' }
4
}
5
6
dependencies {
7
// Any other dependencies
8
implementation'com.getyourmap:glmap:1.1.0'
9
implementation'com.getyourmap:glroute:1.1.0' // if you need navigation
10
implementation'com.getyourmap:glsearch:1.1.0' // if you need search
11
}
Copied!

Use framework from Java

Add GLMapView into layout file
1
<com.getyourmap.glmap.GLMapView
2
android:id="@+id/map_view"
3
android:layout_width="match_parent"
4
android:layout_height="match_parent"
5
android:gravity="center"
6
android:keepScreenOn="true"/>
Copied!
Initialize GLMapManager inside Application subclass. And set your API key from user cabinet.
YourApp.java
1
public class YourApp extends Application
2
{
3
@Override
4
public void onCreate()
5
{
6
super.onCreate();
7
GLMapManager.Initialize(this, <API_KEY>, null);
8
9
// If you're going to use GLSearch you should also call
10
// GLSearch.Initialize(this);
11
// to let it load it's resources.
12
}
13
}
Copied!
Then configure GLMapView.
YourActivity.java
1
@Override
2
protected void onCreate(Bundle savedInstanceState) {
3
super.onCreate(savedInstanceState);
4
setContentView(R.layout.activity_main);
5
6
// set asset manager, and load style from bundle inside assets
7
GLMapView mapView = (GLMapView) this.findViewById(R.id.map_view);
8
mapView.loadStyle(this.getAssets(), "DefaultStyle.bundle");
9
}
Copied!
Now you're ready to write your app with GLMap framework. Consider our Demo App as source of examples and code snippets.
Last modified 2yr ago