Merge pull request #362 from osm2vectortiles/below_zoom_improved

Improve add jobs from 0 to job_zoom to the end of the list
feature/motorway_junction
Lukas Martinelli 2016-06-23 09:11:22 +02:00 zatwierdzone przez GitHub
commit 6bfb975afd
4 zmienionych plików z 16 dodań i 7 usunięć

Wyświetl plik

@ -1,4 +1,4 @@
FROM golang:1.5.3
FROM golang:1.4
RUN go get github.com/lukasmartinelli/pgclimb \
&& go install github.com/lukasmartinelli/pgclimb

Wyświetl plik

@ -2,7 +2,7 @@
"""Generate jobs for rendering tiles in pyramid and list format in JSON format
Usage:
generate_jobs.py pyramid <x> <y> <z> --job-zoom=<job-zoom>
generate_jobs.py pyramid <x> <y> <z> --job-zoom=<job-zoom> [--max-zoom=<max-zoom>]
generate_jobs.py list <list_file> --batch-size=<batch_size>
generate_jobs.py (-h | --help)
generate_jobs.py --version
@ -10,7 +10,8 @@ Usage:
Options:
-h --help Show this screen.
--version Show version.
--job-zoom=<job-zoom> Max zoom level for pyramid jobs.
--job-zoom=<job-zoom> Job zoom level for pyramid jobs.
--max-zoom=<max-zoom> Max zoom level for pyramid jobs. [default: 14]
--batch-size=<batch_size> Amount of tiles for list jobs.
"""
@ -87,7 +88,7 @@ def split_tiles_into_batch_jobs(tiles, batch_size):
yield create_list_batch_job(tiles_batch)
def pyramid_jobs(x, y, z, job_zoom):
def pyramid_jobs(x, y, z, job_zoom, max_zoom):
"""
Generate pyramid jobs for a given job_zoom level
starting at with the parent tile defined by x, y, z.
@ -96,7 +97,7 @@ def pyramid_jobs(x, y, z, job_zoom):
bounds = mercantile.bounds(x, y, z)
yield create_pyramid_job(
x=x, y=y,
min_zoom=z, max_zoom=14,
min_zoom=z, max_zoom=max_zoom,
bounds=bounds
)
return
@ -107,7 +108,7 @@ def pyramid_jobs(x, y, z, job_zoom):
for tile in pyramid_zoom_level_tiles:
bounds = mercantile.bounds(tile.x, tile.y, tile.z)
yield create_pyramid_job(tile.x, tile.y, min_zoom=tile.z,
max_zoom=14, bounds=bounds)
max_zoom=max_zoom, bounds=bounds)
bounds = mercantile.bounds(0 , 0 , 0)
yield create_pyramid_job(0, 0, min_zoom=0, max_zoom=job_zoom-1, bounds=bounds)
@ -117,12 +118,13 @@ if __name__ == '__main__':
if args['pyramid']:
job_zoom = int(args['--job-zoom'])
max_zoom = int(args['--max-zoom'])
x = int(args['<x>'])
y = int(args['<y>'])
z = int(args['<z>'])
for job in pyramid_jobs(x, y, z, job_zoom):
for job in pyramid_jobs(x, y, z, job_zoom=job_zoom, max_zoom=max_zoom):
print(json.dumps(job), flush=True)
if args['list']:

Wyświetl plik

@ -9,12 +9,18 @@ readonly TILE_X=${TILE_X:-"0"}
readonly TILE_Y=${TILE_Y:-"0"}
readonly TILE_Z=${TILE_Z:-"0"}
readonly JOB_ZOOM=${JOB_ZOOM:-"8"}
readonly WORLD_JOB=${WORLD_JOB:-"true"}
function generate_world_jobs() {
local jobs_file="$EXPORT_DATA_DIR/world_jobs.txt"
local jobs_queue="jobs"
python generate_jobs.py pyramid "$TILE_X" "$TILE_Y" "$TILE_Z" --job-zoom="$JOB_ZOOM" > $jobs_file
if [ "$WORLD_JOB" = true ] ; then
python generate_jobs.py pyramid "0" "0" "0" --job-zoom="0" --max-zoom="$((JOB_ZOOM-1))" >> $jobs_file
fi
pipecat publish --amqpuri="$AMQP_URI" "$jobs_queue" < $jobs_file
}

Wyświetl plik

@ -114,6 +114,7 @@ def test_distributed_worker():
'-e', 'TILE_Y={}'.format(y),
'-e', 'TILE_Z={}'.format(z),
'-e', 'JOB_ZOOM={}'.format(job_zoom),
'-e', 'WORLD_JOB=false',
'generate-jobs'
])