openmaptiles-ios-demo

Offline Map for Mobile

This repo describes how to build an Offline Map for mobile on iOS. Local assets such as vector data, styles, glyphs and sprites are built into a sample iOS app.

Features

Build

The MapLibre Mobile SDK is installed via the Swift Package Manager.

GitHub Actions


Command Line Building

# Build
xcodebuild -scheme GeographyClass build

# Test
xcodebuild -scheme GeographyClass test \
  -destination 'platform=iOS Simulator,name=iPhone 8'

# Test without building
xcodebuild -scheme GeographyClass test-without-building   \
  -destination 'platform=iOS Simulator,name=iPhone 11 Pro' \
  -destination 'platform=iOS,name=iPhone 8' \

Mapbox token

open openmaptiles-ios-demo.xcodeproj

Architecture

"sources": {
    "countries": {
        "type": "vector",
        "tiles": [
            "asset://geography-class.osm2vectortiles/{z}/{x}/{y}.pbf"
        ]
    }
},
"sprite": "asset://sprites/bright-v8",
"glyphs": "asset://glyphs/{fontstack}/{range}.pbf",

Soft Proofing Tiles

You can Soft Proof your tiles before they are installed into mobile by using Tileserver GL.

Sample Tile JSON & Styles

Tile JSON with GitHub served .pbf. Choose either the Tile JSON or Mapbox Style

Locally served .pbf

# Install `serve` from https://www.npmjs.com/package/serve
#  yarn global add serve   # do this once

cd OSM2VectorTiles

# Serve raw `.pbf` files using [serve](https://www.npmjs.com/package/serve)
# serve -v # version

# Be sure to open `http://localhost:5000` to confirm what is being served
serve --cors --listen 5000 # serve current directory; CORS; listen on port 5000

# Using a different server to hook into those raw tiles
alias tsgl='docker run --rm -it -v "$(pwd)":/data -p 8081:80 maptiler/tileserver-gl --verbose'

tsgl  # starts Tileserver GL using the file config.json

Zurich Sample

Using the Zurich Sample from Maptiler.

See the metadata for details on

Available Endpoints
tsgl --config OSM2VectorTiles/tileserver-gl/config.zurich.json

Geography Class

Geography Class does not conform the OpenMapTiles schema v3. You can inspect

Available Endpoints
tsgl --config tileserver-gl/config.geography-class.json

geography-class


Building

You can build the Mapbox Maps v10 version by checking out the tag v10-geography-class

export REPO=roblabs/openmaptiles-ios-demo

git clone --recursive \
  https://github.com/$REPO.git \
  tmp/$REPO

cd tmp/$REPO

TAG=v10-geography-class
git checkout tags/$TAG -b $TAG
xed .

Change Log