Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
C++/OpenGL map renderer
Failed to load latest commit information.
.mason @ 03869fd cleanup makefiles
android #923 - Consolidating package namespaces
bin fixes #476 & #853: pixel/meter/latlng conversion routines in core & iOS
common refs #725: add large source icon
config move config files to config/ folder
deps use -lpthread instead of -pthread
gyp add ca bundle loading back to CURL
include/mbgl Add projection functions to Java
ios move iOS code from gl-cocoa to this project
linux fixes #476 & #853: pixel/meter/latlng conversion routines in core & iOS
macosx fixes #476 & #853: pixel/meter/latlng conversion routines in core & iOS
platform Fixed new clang errors in Xcode 6.3b2
proto rename llmr => mbgl
scripts dont install makedepend on travis
src Removed special cased zoom level for HiDPI
styles @ 25b1b7d Add compass support
test add missing test fixture file
travis Move to mapbox bucket
utils/mbgl-config fix install script
.clang-format rearrange tests and make more robust
.gitignore move iOS code from gl-cocoa to this project
.gitmodules move iOS code from gl-cocoa to this project
.travis.yml Fix tab
LICENSE.md add license file
Makefile add ca bundle loading back to CURL
README.md edits based on life experience
configure Use libuv 1.4.0 for arm64 support
mbgl.gyp move iOS code from gl-cocoa to this project
update_icons.sh Fix find argument order

README.md

Travis

An OpenGL renderer for Mapbox Vector Tiles, implemented in C++11, currently targeting iOS, OS X, Android, and Ubuntu Linux.

Depends

Build instructions

We try to link to as many system-provided libraries as possible. When these are unavailable or too outdated, we run a thin build-script layer called Mason to automate builds, and load precompiled binary packages when possible.

Be sure to pull down all submodules first:

git submodule init
git submodule update

OS X

Prerequisites include the Boost headers (for routines provided therein) and ImageMagick (for tests). To install all prerequisites, use Homebrew and type brew install pkg-config boost imagemagick.

To create projects, you can run:

  • make xproj: Creates an Xcode project with OS X-specific handlers for HTTP downloads and settings storage. It uses GLFW for window handling.
  • make lproj: Creates an Xcode project with platform-independent handlers for downloads and settings storage. This is what is also being built on Linux.
  • make osx run-osx: Builds and runs the OS X application on the command line with xcodebuild.
  • make linux run-linux: Builds and runs the Linux application with make.
  • make test-* Builds and runs all tests. You can specify individual tests by replacing * with their name.

Note that you can't have more than one project in Xcode open at a time since they the static library project is shared across the OS X, Linux and iOS project.

Target OS X: 10.9+

iOS

If you merely want to install the library for iOS and try it out as an Objective-C consumer, run ./scripts/package_ios.sh. It requires the Boost headers to be installed, so use Homebrew to install them (brew install boost). The packaging script will produce the statically-linked libMapboxGL.a, MapboxGL.bundle for resources, and a Headers folder.

If you want to build from source and/or contribute to development of the project, run make iproj, which will create and open an Xcode project which can build the entire library from source as well as an Objective-C test app.

Target devices: iPhone 4S and above (5, 5c, 5s, 6, 6 Plus) and iPad 2 and above (3, 4, Mini, Air, Mini 2, Air 2).

Target iOS: 7.0 through 8.1

Linux

We are using Ubuntu for development. While the software should work on other distributions as well, we are not providing explicit build instructions here.

Install GCC 4.8+ if you are running Ubuntu 13.10 or older. Alternatively, you can also use Clang 3.4+.

sudo add-apt-repository --yes ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get install gcc-4.8 g++-4.8

Ensure you have git and other build essentials:

sudo apt-get install curl git build-essential zlib1g-dev automake \
                     libtool xutils-dev make cmake pkg-config python-pip \
                     libcurl4-openssl-dev libpng-dev libsqlite3-dev

Install glfw3 dependencies:

sudo apt-get install libxi-dev libglu1-mesa-dev x11proto-randr-dev \
                     x11proto-xext-dev libxrandr-dev \
                     x11proto-xf86vidmode-dev libxxf86vm-dev \
                     libxcursor-dev libxinerama-dev

Finally, install Boost. If you're running Ubuntu 12.04 or older, you need to install a backport PPA since the version provided by APT doesn't contain Boost Geometry:

sudo add-apt-repository --yes ppa:boost-latest/ppa
sudo apt-get update
sudo apt-get install libboost1.55-dev

Otherwise, you can just install

sudo apt-get install libboost-dev

Once you're done installing the build dependencies, you can get started by running

./configure

Then, you can then proceed to build the library:

git submodule update --init
make linux

Set an access token as described below, and then run:

make run-linux

Android

Target devices: All Android devices on Android 4.0 or newer (API level >= 14).

On Linux

Install a few build dependencies:

apt-get install -y make git build-essential automake \
libtool make cmake pkg-config lib32stdc++6 lib32z1

Install Oracle JDK 7 (requires license agreement) from http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html

export JAVA_HOME="/dir/to/jdk1.7.0_71"

Install the Android NDK Revision 10d.

export ANDROID_NDK_PATH="/dir/to/android-ndk-r10d"

Install the Android SDK. We recommend doing this by way of Android Studio.

export ANDROID_HOME="/dir/to/android-sdk-linux"

Run:

make android

You can then open android/java in Android Studio via "Import Non-Android Studio Project".

On OS X

Install Oracle JDK 7+:

brew cask install java

Install the Android NDK Revision 10d for 64-bit OS X:

brew install android-ndk

This will also install the dependency android-sdk.

Install Android Studio:

brew cask install android-studio
android

By default, the SDK will be installed to /usr/local/opt/android-sdk. If you open Android Studio at this point, you may get an error message telling you that it can't find a JVM, it's because you installed a custom Java VM from Oracle. Follow these instructions to start Android Studio. You'll wind up setting these environment variables in your .bash_profile or similar:

echo "export ANDROID_HOME=`brew --prefix android-sdk`" >> .bash_profile
echo "export ANDROID_NDK_PATH=`brew --cellar android-ndk`/r10d" >> .bash_profile
# Replace <path to JDK> with something like /Library/Java/JavaVirtualMachines/jdk1.8.0_31.jdk
echo "export JAVA_HOME=<path to JDK>" >> .bash_profile
echo "export STUDIO_JDK=$JAVA_HOME" >> .bash_profile

Run:

make android
open -a Android\ Studio

You can then open android/java in Android Studio via "Import Non-Android Studio Project".

Troubleshooting

To trigger a complete rebuild, run make clean and then start over generating the Xcode projects or Makefiles as described above.

If you are having trouble getting the dependencies right, you can blow away the mason_packages directory, or run make distclean. This means the Makefile and configure script will automatically install the dependencies again on the next try.

On OS X, you can also try clearing the Xcode cache with make clear_xcode_cache.

Mapbox API access tokens

The demo applications use Mapbox vector tiles, which require a Mapbox account and API access token. Obtain an access token on the Mapbox account page.

For iOS and OS X use of the demo apps in Xcode, setup the access token by editing the scheme for the application target, then adding an environment variable with the name MAPBOX_ACCESS_TOKEN.

edit scheme

setting access token in Xcode scheme

For Linux, set the environment variable MAPBOX_ACCESS_TOKEN to your token.

For Android, gradle will take the value of MAPBOX_ACCESS_TOKEN and save it to android/java/app/src/main/res/raw/token.txt where the app will read it from.

Style

Some styles in JSON format are included at ./styles. See the style spec for more details.

Usage

Desktop

  • Press X to reset the transform
  • Press N to reset north
  • Press Tab to toggle debug information
  • Press Esc to quit

Mobile

  • Pan to move
  • Pinch to zoom
  • Use two fingers to rotate
  • Double-tap to zoom in one level
  • Two-finger single-tap to zoom out one level
  • Double-tap, long-pressing the second, then pan up and down to "quick zoom" (iPhone only, meant for one-handed use)

Other notes

Under early development, this project was called LLMR (Low-Level Map Renderer), in case you see any lingering references to it.

Something went wrong with that request. Please try again.