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.
The MapLibre Mobile SDK is installed via the Swift Package Manager.
# 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' \
Create a new plain text file containing your access token, named either .mapbox or mapbox. To avoid accidentally committing this file to an open-source project, either you can save it to a location outside your project’s version-controlled directory, or you can add this file to your project’s .gitignore file.
open openmaptiles-ios-demo.xcodeproj
asset://
URI."sources": {
"countries": {
"type": "vector",
"tiles": [
"asset://geography-class.osm2vectortiles/{z}/{x}/{y}.pbf"
]
}
},
"sprite": "asset://sprites/bright-v8",
"glyphs": "asset://glyphs/{fontstack}/{range}.pbf",
You can Soft Proof your tiles before they are installed into mobile by using Tileserver GL.
.pbf
can be compressed when using tippecanoe
: mapbox / tippecanoe #582
tippecanoe -pC --maximum-zoom=7 -o poly.pC.mbtiles poly.geojson
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
Using the Zurich Sample from Maptiler.
See the metadata
for details on
docker
or npm
.v3
with a Basic style
tsgl --config OSM2VectorTiles/tileserver-gl/config.zurich.json
Geography Class does not conform the OpenMapTiles schema v3
. You can inspect
tsgl --config tileserver-gl/config.geography-class.json
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 .
5.12.0-pre.1
. MetalANGLE build.5.10.0
to 5.11.0
asset://
mapbox-maps-ios-v10
updated with MapboxMaps Library from https://github.com/mapbox/mapbox-maps-ioscarthage
, if needed.config.json
for use by Tileserver GL