tilezen / vector-datasource

Tilezen vector tile service - OpenStreetMap data in several formats
https://www.nextzen.org/
Other
505 stars 118 forks source link

How to pre cache tiles for specific regions. I want to generate topojson files and serve them through nginx. Can someone plz help me in that. #968

Closed 20sandeepsingh closed 8 years ago

20sandeepsingh commented 8 years ago

How to pre cache tiles for specific regions. I want to generate topojson files on the disk and serve them using nginx.

rmarianski commented 8 years ago

We don't have something quite out of the box for this, because this sort of thing tends to bring a lot of operational concerns along, and each deployment environment tends to be different. But, I can offer some pointers as to where you could start.

The tilequeue "process" command will be able to generate tiles for you offline. There is a concept of a "store", which is where tiles get written to, and a "queue", which is where the work comes from. There is a filesystem store that you can configure, and a file based queue that you can use, although those are meant more for local testing with a single instance. But if you are pre-caching tiles for a small region on a single instance, you may be able to get away with it. At Mapzen we use aws services, with s3 as our store and sqs as our queue.

If you do happen to poke around and get something working for your needs, we'd be happy to accept prs either for docs or for any tweaks to the code.

nvkelso commented 8 years ago

You could also use TileStashe seed script in front of Mapzen's tile service, but we don't have documentation for that at this time.

On Aug 16, 2016, at 17:02, Robert Marianski notifications@github.com wrote:

Closed #968.

― You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

nvkelso commented 8 years ago

Specifically: https://github.com/TileStache/TileStache/blob/master/scripts/tilestache-seed.py

On Tue, Aug 16, 2016 at 3:18 PM, Nathaniel V. KELSO nathaniel@mapzen.com wrote:

You could also use TileStashe seed script in front of Mapzen's tile service, but we don't have documentation for that at this time.

On Aug 16, 2016, at 17:02, Robert Marianski notifications@github.com wrote:

Closed #968 https://github.com/tilezen/vector-datasource/issues/968.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/tilezen/vector-datasource/issues/968#event-757678552, or mute the thread https://github.com/notifications/unsubscribe-auth/AA0EOxl9NwUttOYgza73Aam7ViZLgP-Cks5qgiV7gaJpZM4Jlyn0 .

20sandeepsingh commented 8 years ago

Looks like tilequeue process command needs a query config file. Do you have any query config file which can work with tilequeue and getnerate same layers as mapzen tileserver.

rmarianski commented 8 years ago

https://github.com/tilezen/tilequeue/blob/master/config.yaml.sample

Note, the sample config isn't as up to date as it should be. It's on our radar to resolve that. But, I'm hoping it should be enough for you to get started. We haven't changed the store or queue config in a while.

All the options are parsed in the command and config files, so you can take a peek at the code to see exactly what options are being used and how.

20sandeepsingh commented 8 years ago

I am still not able to get tilequeue to work. I have updated tilequeue config after going through the tilequeue code and the command works without any error but it is not processing the tiles. Below is the command I ran tilequeue process --config tilequeue-config.yaml and I kept it running for more than 12 hours.

This is the console log generated by this command 2016-08-18 18:35:38,716 - process - WARNING - tilequeue processing started 2016-08-18 18:35:38,716 - process - WARNING - /home/ss/maps/vector-datasource/queries.yaml 2016-08-18 18:35:38,849 - process - WARNING - all tilequeue threads and processes started

And this is the tilequeue config file queue:

type can be sqs, file, mem, or redis

type: file name: fqueue store: type: directory # Can also be directory, which would dump the tiles to disk. name: /home/ss/maps/vector-datasource/vtiles

The following store properties are s3 specific.

path: /home/ss/maps/vector-datasource reduced-redundancy: true date-prefix: 19851026 aws: credentials: aws_access_key_id: aws_secret_access_key: tiles: seed: all: zoom-start: 0 zoom-until: 5 process: n-simultaneous-query-sets: 1 log-queue-sizes: false log-queue-sizes-interval-seconds: 1 query-config: /home/ss/maps/vector-datasource/queries.yaml template-path: /home/ss/maps/vector-datasource/queries reload-templates: false formats: [topojson] tilestache: config: <path/to/config/file> formats: [json, vtm] logging:

logging.conf on this page:

https://docs.python.org/2/howto/logging.html#logging-basic-tutorial

config: logging.conf.sample redis: type: stub host: localhost port: 6379 db: 0 cache-set-key: tilequeue.tiles-of-interest postgresql: host: localhost port: 5432 dbnames: [osm] user: postgres password: wof:

url path to neighbourhoods, microhoods, and macrohoods meta csv files

neighbourhoods-meta-url: https://github.com/whosonfirst/whosonfirst-data/raw/master/meta/wof-neighbourhood-latest.csv microhoods-meta-url: https://github.com/whosonfirst/whosonfirst-data/raw/master/meta/wof-microhood-latest.csv macrohoods-meta-url: https://github.com/whosonfirst/whosonfirst-data/raw/master/meta/wof-macrohood-latest.csv boroughs-meta-url: https://github.com/whosonfirst/whosonfirst-data/raw/master/meta/wof-borough-latest.csv

url path prefix for wof raw data

data-prefix-url: http://whosonfirst.mapzen.com/data

filesystem path to wof data checkout

data-path: /tmp/whosonfirst-data postgresql: host: localhost port: 5432 dbname: osm user: postgres password:

Below is the output of ps -ef|grep tilequeue /home/ss/maps/env/bin/python /home/ss/maps/env/bin/tilequeue process --config tilequeue-config.yaml /home/ss/maps/env/bin/python /home/ss/maps/env/bin/tilequeue process --config tilequeue-config.yaml /home/ss/maps/env/bin/python /home/ss/maps/env/bin/tilequeue process --config tilequeue-config.yaml /home/ss/maps/env/bin/python /home/ss/maps/env/bin/tilequeue process --config tilequeue-config.yaml /home/ss/maps/env/bin/python /home/ss/maps/env/bin/tilequeue process --config tilequeue-config.yaml /home/ss/maps/env/bin/python /home/ss/maps/env/bin/tilequeue process --config tilequeue-config.yaml /home/ss/maps/env/bin/python /home/ss/maps/env/bin/tilequeue process --config tilequeue-config.yaml /home/ss/maps/env/bin/python /home/ss/maps/env/bin/tilequeue process --config tilequeue-config.yaml /home/ss/maps/env/bin/python /home/ss/maps/env/bin/tilequeue process --config tilequeue-config.yaml

rmarianski commented 8 years ago

You need to run a tilequeue seed first to enqueue the tiles you want to process. That should populate the file fqueue with a list of tile coordinates. After that, the tilequeue process should read through that file and generates tiles in the store directory. I'm not sure if the name on the store supports a path offhand, but if it doesn't it should be straightforward to add.

Thanks for giving this a go!

20sandeepsingh commented 8 years ago

Successfully started the tiling process, thanks for the information..

rmarianski commented 8 years ago

Glad to hear it! Thanks for reporting back.