Skip to content
This repository has been archived by the owner on Dec 4, 2017. It is now read-only.

Latest commit

 

History

History
63 lines (49 loc) · 1.71 KB

README.md

File metadata and controls

63 lines (49 loc) · 1.71 KB

gl-style-schema

⚠️ This repository is no longer maintained by Lukas Martinelli.

Dump the vector tile schema defined in a TileJSON spec or as required by Mapbox GL style JSON.

Use Cases:

  • Compare used schema in style vs provided schema (check how much of the schema you actually use)
  • Compare two different vector tile sets
  • Compare schema required by multiple styles

Usage

# Dump schema required by a Mapbox GL style
wget "https://raw.githubusercontent.com/osm2vectortiles/mapbox-gl-styles/master/styles/bright-v9-cdn.json"
./gl-style-schema.py bright-v9-cdn.json

# Dump schema as defined in TileJSON
wget "https://osm2vectortiles.tileserver.com/v2.json"
./gl-style-schema.py v2.json

Output

Layers are denoted with #layer and fields with [field].

#admin
  [admin_level]
  [disputed]
  [maritime]
#aeroway
  [type]
#airport_label
  [scalerank]
#country_label
  [scalerank]
#landuse
  [class]
#landuse_overlay
  [class]
#marine_label
  [labelrank]

Compare

Compare the vector tile schema of OSM2VectorTiles with Mapbox Streets.

# TileJSON URLs
MBSTREETS_TILEJSON="http://api.mapbox.com/v4/mapbox.mapbox-streets-v7.json?access_token=pk.eyJ1IjoibW9yZ2Vua2FmZmVlIiwiYSI6IjIzcmN0NlkifQ.0LRTNgCc-envt9d5MzR75w"
OSMVT_TILEJSON="https://osm2vectortiles.tileserver.com/v2.json"

# Dump schemas
curl $MBSTREETS_TILEJSON | ./gl-style-schema.py > mapbox-streets-v7.schema
curl $OSMVT_TILEJSON | ./gl-style-schema.py > osm2vectortiles-v2.schema

# Compare schemas
diff -c mapbox-streets-v7.schema osm2vectortiles-v2.schema