Find the real tiles that should exist.
mercantile children "[0,0,0]" --depth 8 > correct_tiles.txtFind the list of MBTiles from S3
| #!/usr/bin/env python | |
| import csv | |
| import sys | |
| import os | |
| import mercantile | |
| DELIMITER = os.getenv('DELIMITER', ' ') | |
| def calculate_center(x, y, zoom): |
| import json | |
| doc = json.load(open('cities.json')) | |
| for region, region_obj in doc['regions'].items(): | |
| for city_name, city_obj in region_obj['cities'].items(): | |
| bbox = city_obj['bbox'] | |
| parts = city_name.split('_') | |
| if len(parts) != 2: | |
| continue |
| CREATE VIEW poi_label_zoom_level_changes AS ( | |
| SELECT osm_id, timestamp FROM poi_label_z14 | |
| ); | |
| CREATE VIEW road_zoom_level_changes AS ( | |
| SELECT osm_id, timestamp FROM road_z14 | |
| UNION ALL | |
| SELECT osm_id, timestamp FROM road_z13 | |
| UNION ALL |
| CREATE OR REPLACE FUNCTION point_to_tiles( | |
| _point geometry | |
| ) RETURNS SETOF tile | |
| AS $$ | |
| DECLARE | |
| d2r CONSTANT DOUBLE PRECISION := pi() / 180; | |
| lon CONSTANT DOUBLE PRECISION := st_x(ST_Transform(_point, 4326)); | |
| lat CONSTANT DOUBLE PRECISION := st_y(ST_Transform(_point, 4326)); | |
| _sin CONSTANT DOUBLE PRECISION := sin(lat * d2r); |
| osm_id | name | type | lon | lat | |
|---|---|---|---|---|---|
| 240037787 | Hämikon | village | 8.280409935521845 | 47.24071495001383 | |
| 240125902 | Müswangen | village | 8.291551999410387 | 47.238828937980735 | |
| 240053323 | Beinwil (Freiamt) | village | 8.342289670976442 | 47.2302282671344 | |
| 1808444632 | Winterschwil | hamlet | 8.339991017850139 | 47.24019191925577 | |
| 1102444816 | Guggibad | hamlet | 8.297054467386715 | 47.273120225872944 | |
| 1102444811 | Brandholz | hamlet | 8.292870556598615 | 47.2803594241868 | |
| 240106365 | Geltwil | village | 8.322386674252868 | 47.249199028587 | |
| 1808444611 | Isenbergschwil | hamlet | 8.33719154600922 | 47.246563422953116 | |
| 240053497 | Buttwil | village | 8.311204880143265 | 47.2675939532916 |
| 128/100/8 | |
| 128/101/8 | |
| 128/102/8 | |
| 128/103/8 | |
| 128/104/8 | |
| 128/105/8 | |
| 128/106/8 | |
| 128/107/8 | |
| 128/108/8 |
Find the real tiles that should exist.
mercantile children "[0,0,0]" --depth 8 > correct_tiles.txtFind the list of MBTiles from S3
| #!/bin/bash | |
| tilelive-copy --minzoom=0 --maxzoom=14 --bounds="60.403889,29.288333,74.989862,38.5899217" world.mbtiles afghanistan.mbtiles | |
| tilelive-copy --minzoom=0 --maxzoom=14 --bounds="19.0246095,39.5448625,21.1574335,42.7611669" world.mbtiles albania.mbtiles | |
| tilelive-copy --minzoom=0 --maxzoom=14 --bounds="-8.7689089,18.868147,12.097337,37.3962055" world.mbtiles algeria.mbtiles | |
| tilelive-copy --minzoom=0 --maxzoom=14 --bounds="1.3135781,42.3288238,1.8863837,42.7559357" world.mbtiles andorra.mbtiles | |
| tilelive-copy --minzoom=0 --maxzoom=14 --bounds="11.3609793,-18.1389449,24.18212,-4.2888889" world.mbtiles angola.mbtiles | |
| tilelive-copy --minzoom=0 --maxzoom=14 --bounds="-63.7391991,17.9609378,-62.6125448,18.8951194" world.mbtiles anguilla.mbtiles | |
| tilelive-copy --minzoom=0 --maxzoom=14 --bounds="-73.6603073,-55.285076,-53.5374514,-21.6811679" world.mbtiles argentina.mbtiles | |
| tilelive-copy --minzoom=0 --maxzoom=14 --bounds="43.3471395,38.7404775,46.7333087,41.400712" world.mbtiles armenia.mbtiles |
| from img_rotate import fix_orientation | |
| from PIL import Image | |
| def fix_img(img): | |
| proper_img = fix_orientation(img) | |
| proper_img.thumbnail(1500, 1500), Image.ANTIALIAS) | |
| return proper_img |
| DELETE FROM import.filepaths_1 | |
| WHERE data->>'repo' IN | |
| (SELECT data->>'repo' | |
| FROM (SELECT data->>'repo', ROW_NUMBER() OVER (partition BY data->>'repo' ORDER BY data->>'repo') AS rnum | |
| FROM import.filepaths_1) t | |
| WHERE t.rnum > 1 | |
| ); |