mapbox / node-mapnik-bench

Framework for quickly exploring tile rendering performance across mapnik versions
4 stars 3 forks source link

feature suggestions #17

Open wilhelmberg opened 8 years ago

wilhelmberg commented 8 years ago

@mapsam (/cc @springmeyer ) you might want to look at (and maybe carry over) same additions I did in https://github.com/BergWerkGIS/investigate-gpx

---concurrency

control how many maps are created in the mapnik pool. I've carried over Math.ceil(require('os').cpus().length * 16) from some tilelive module, but I think somewhere else it gets limited to 16 anyway (don't remember where I saw that).

https://github.com/BergWerkGIS/investigate-gpx/blob/9e86ced0559e88195857417a66609552837d1125/bench.js#L23

https://github.com/BergWerkGIS/investigate-gpx/blob/9e86ced0559e88195857417a66609552837d1125/bench.js#L150

--show-progress

more verbose output than --verbose. e.g. shows tiles/sec not only at the end, but also in between

https://github.com/BergWerkGIS/investigate-gpx/blob/9e86ced0559e88195857417a66609552837d1125/bench.js#L24

https://github.com/BergWerkGIS/investigate-gpx/blob/9e86ced0559e88195857417a66609552837d1125/bench.js#L35

https://github.com/BergWerkGIS/investigate-gpx/blob/9e86ced0559e88195857417a66609552837d1125/bench.js#L130-L137

https://github.com/BergWerkGIS/investigate-gpx/blob/9e86ced0559e88195857417a66609552837d1125/bench.js#L153-L161

workarounds to generate webp tiles

1.

If your are working with vector sources the trick is to include a raster into the mapnik.xml: https://github.com/BergWerkGIS/investigate-gpx/blob/9e86ced0559e88195857417a66609552837d1125/style.xml.template#L28-L39

Caution(!): This adds a little raster at null-island so be sure to always include --bounds when using that otherwise the map extent will be pretty big and slow down things considerably.

2.

The mapnik.xml has to have style in its name to set the file extension of the resulting tiles correctly:

https://github.com/BergWerkGIS/investigate-gpx/blob/9e86ced0559e88195857417a66609552837d1125/bench.js#L88

This is just for getting the correct file extension. No matter what extension you pass here

sink = 'file://' + path.join(__dirname, argv.output+'?filetype=' + filetype);

the output format of the tiles is always determined by tilelive-brigde automatically depending what types of layers are found in the map. Hence (workaround #1).

slippy map for viewing generated tiles

run the bench, then node show-tiles-server.js, then http://localhost:666

https://github.com/BergWerkGIS/investigate-gpx/blob/9e86ced0559e88195857417a66609552837d1125/show-tiles-server.js

https://github.com/BergWerkGIS/investigate-gpx/blob/9e86ced0559e88195857417a66609552837d1125/show-tiles.html

https://github.com/BergWerkGIS/investigate-gpx/tree/9e86ced0559e88195857417a66609552837d1125/leaflet

It's working for webp tiles. Not so much for pbf files. I somehow have troubles extracting them. Maybe that's an exercise left to the reader :smirk: https://github.com/BergWerkGIS/investigate-gpx/blob/9e86ced0559e88195857417a66609552837d1125/show-tiles-server.js#L59-L95

mapsam commented 8 years ago

Great ideas @BergWerkGIS! So many options :smile: Once we get a solid fixture suite set up I'll start taking a look at these.