This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from redis import StrictRedis | |
from tilequeue.cache import RedisCacheIndex | |
from tilequeue.tile import coord_to_bounds | |
from tilequeue.tile import coord_unmarshall_int | |
from tilequeue.tile import serialize_coord | |
import shapely.geometry | |
redis_host = '...' | |
redis_client = StrictRedis(redis_host) | |
cache_index = RedisCacheIndex(redis_client) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-------------------------------------------------------------------------------- | |
-- disable-triggers.sql | |
-------------------------------------------------------------------------------- | |
ALTER TABLE planet_osm_point DISABLE TRIGGER USER; | |
ALTER TABLE planet_osm_polygon DISABLE TRIGGER USER; | |
ALTER TABLE planet_osm_line DISABLE TRIGGER USER; | |
-------------------------------------------------------------------------------- | |
-- functions.sql |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ALTER TABLE planet_osm_point DISABLE TRIGGER USER; | |
ALTER TABLE planet_osm_polygon DISABLE TRIGGER USER; | |
ALTER TABLE planet_osm_line DISABLE TRIGGER USER; | |
-- IF YOU UPDATE THIS, PLEASE UPDATE mz_calculate_landuse_kind | |
-- BELOW! | |
CREATE OR REPLACE FUNCTION mz_calculate_is_landuse( | |
landuse_val text, leisure_val text, natural_val text, highway_val text, | |
amenity_val text, aeroway_val text, tourism_val text, man_made_val text, | |
power_val text, boundary_val text) | |
RETURNS BOOLEAN AS $$ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from tilequeue.transform import apply_to_all_coords | |
from tilequeue.transform import rescale_point | |
import shapely.wkt | |
def coerce_int((x, y)): | |
return int(x), int(y) | |
def make_fn(fn): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DROP FUNCTION IF EXISTS mz_is_path_named_or_designated(text, text, text, text, text, text, text); | |
DROP INDEX IF EXISTS planet_osm_line_natural_geom_index; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
UPDATE planet_osm_line | |
SET mz_landuse_min_zoom = mz_calculate_min_zoom_landuse(planet_osm_line.*) | |
WHERE | |
(highway IN ('pedestrian', 'footway') OR | |
aeroway IN ('runway', 'taxiway') OR | |
man_made IN ('pier', 'breakwater', 'groyne', 'dike', 'cutline')) | |
AND COALESCE(mz_calculate_min_zoom_landuse(planet_osm_line.*), 999) <> COALESCE(mz_landuse_min_zoom, 999); | |
UPDATE planet_osm_line | |
SET mz_road_level = mz_calculate_min_zoom_roads(planet_osm_line.*) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from tilequeue.tile import coord_to_mercator_bounds | |
from tilequeue.tile import deserialize_coord | |
from tilequeue.process import _find_meters_per_pixel | |
coord = deserialize_coord('10/100/100') | |
merc_bounds = coord_to_mercator_bounds(coord) | |
tile_meters_wide = merc_bounds[2] - merc_bounds[0] | |
meters_per_pixel = _find_meters_per_pixel(10) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
189119734 function calls (181785794 primitive calls) in 654.281 seconds | |
Ordered by: cumulative time | |
ncalls tottime percall cumtime percall filename:lineno(function) | |
4/3 0.063 0.016 651.103 217.034 /usr/local/lib/python2.7/dist-packages/tilequeue/process.py:409(process_coord) | |
3 0.073 0.024 644.967 214.989 /usr/local/lib/python2.7/dist-packages/tilequeue/process.py:317(_process_feature_layers) | |
3 0.005 0.002 496.666 165.555 /usr/local/lib/python2.7/dist-packages/tilequeue/process.py:106(_postprocess_data) | |
13899 0.457 0.000 469.550 0.034 /usr/local/lib/python2.7/dist-packages/vector_datasource-1.0.0.dev0-py2.7.egg/vectordatasource/transform.py:733(cut) | |
6 0.024 0.004 469.521 78.253 /usr/local/lib/python2.7/dist-packages/vector_datasource-1.0.0.dev0-py2.7.egg/vectordatasource/transform.py:890(_intercut_impl) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ 42/152] FAIL: 'integration-test/473-landuse-tier.py' | |
Traceback (most recent call last): | |
File "integration-test.py", line 500, in run_test | |
'features_in_mvt_layer': features_in_mvt_layer, | |
File "/usr/lib/python2.7/runpy.py", line 240, in run_path | |
return _run_module_code(code, init_globals, run_name, path_name) | |
File "/usr/lib/python2.7/runpy.py", line 82, in _run_module_code | |
mod_name, mod_fname, mod_loader, pkg_name) | |
File "/usr/lib/python2.7/runpy.py", line 72, in _run_code | |
exec code in run_globals |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
insert into tile_traffic_v4 (date, size, layer, x, y, z, format, api_key, status, total_ms, server, host, service) | |
select date, payload_size, layer, x, y, z, format, api_key, status, total_ms, server, 'vector.mapzen.com' as host, 'vector-tiles' as service | |
from vector_traffic_v2; | |
insert into tile_traffic_v4 (date, size, layer, x, y, z, format, api_key, status, total_ms, server, host, service, version, path) | |
select date, size, layer, x, y, z, format, api_key, status, total_ms, server, host, service, version, path | |
from tile_traffic_v3; |