Meant to create pyramid jobs for OSM2VectorTiles when only a tile list file is available (e.g. recovering missing tiles).
cat missing_tiles.txt | sed 's/MISSING//g' | python generate_pyramid_jobs.py
```
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <meta charset='utf-8' /> | |
| <title>OSM2VectorTiles with Liberty style</title> | |
| <meta name='viewport' content='initial-scale=1,maximum-scale=1,user-scalable=no' /> | |
| <script src='https://api.tiles.mapbox.com/mapbox-gl-js/v0.21.0/mapbox-gl.js'></script> | |
| <link href='https://api.tiles.mapbox.com/mapbox-gl-js/v0.21.0/mapbox-gl.css' rel='stylesheet' /> | |
| <style> |
| import json | |
| import sys | |
| if __name__ == '__main__': | |
| if len(sys.argv) >= 2: | |
| style_src = sys.argv[1] | |
| patch_src = sys.argv[2] | |
| else: | |
| print('patch_mabpox_gl_style.py <style> <patch-src>') |
| """ | |
| Usage example: | |
| cat missing_tiles.txt | sed 's/MISSING//g' | python tiles_to_geojson.py > missing_tiles.geojson | |
| """ | |
| import json | |
| import hashlib | |
| import mercantile |
| #!/bin/bash | |
| set -o errexit | |
| set -o pipefail | |
| set -o nounset | |
| function compress_inplace() { | |
| local filename="$1" | |
| gdal_translate -co compress=lzw "$filename" "$filename.compressed" | |
| rm "$filename" | |
| mv "$filename.compressed" "$f" |
| #admin | |
| [admin_level] | |
| [disputed] | |
| [maritime] | |
| [osm_id] | |
| #aeroway | |
| [osm_id] | |
| [type] | |
| #building | |
| [osm_id] |
Cut compatibility back to support using slightly modified Mapbox Open Styles (OSM Bright and Basic) and iterate from there.
### Schema
Take a look at the diff between future OSM2VectorTiles v3 and Mapbox Streets v7.
| import fileinput | |
| import sys | |
| for line in fileinput.input(): | |
| tokens = line.split('"-"') | |
| time_tokens = tokens[-1].strip().split(' ') | |
| try: | |
| nginx_time, php_time = float(time_tokens[0]), float(time_tokens[1]) | |
| except ValueError: |
| import fileinput | |
| import sys | |
| def around_north_pole(y): | |
| return y < 75 | |
| def around_south_pole(y): | |
| return y > 184 |
| import json | |
| ids = {} | |
| for line in open('failed-jobs.json'): | |
| doc = json.loads(line) | |
| if not doc['id'] in ids: | |
| ids[doc['id']] = True | |
| print(json.dumps(doc)) |