Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Experiment with TIF output #15

Open
yhahn opened this issue Jun 18, 2014 · 6 comments
Open

Experiment with TIF output #15

yhahn opened this issue Jun 18, 2014 · 6 comments
Assignees

Comments

@yhahn
Copy link
Member

yhahn commented Jun 18, 2014

Per voice, in the raster branch tilelive-bridge is currently hardcoded to export 1024x1024 webp tiles for any sources it detects to contain raster data.

To treat rasters more like tiled-performant-raw-data that you can manipulate on the fly/iterate on quickly when styling to get the final output product you want we can experiment with TIF as output format.

I have never used this option in mapnik. Note we won't need any geotif tags as far as I can see (the geo is more or less implied by the tiling/zxy) but I am curious how this output format works in mapnik.

https://github.com/mapnik/mapnik/wiki/Image-IO#tiff-output-options

cc @springmeyer

@yhahn
Copy link
Member Author

yhahn commented Jun 18, 2014

cc @GretaCB

@springmeyer
Copy link
Contributor

Tiff output in Mapnik, if I recall right, is just 32 bit rgba so it does not offer anything on top of webp yet. The limitation here is not just the tiff encoder in Mapnik but more that Mapnik image resizing/clipping only works with rgba images right now. I've been scheming making this making this more flexible but its not quite there yet.

So, I think it would be great to test the tiff output to see if it works, but it does not offer much extra value until I improve Mapnik core.

@rclark
Copy link
Contributor

rclark commented Jun 18, 2014

Sure enough -- took me a few hours to wrap my head around this enough to change four characters, but simply switching https://github.com/mapbox/tilelive-bridge/blob/raster/index.js#L147 to

view.encode('tiff', {}, function(err, buffer) {

... and I get a .tif. It is indeed an rgba so there's no gain there. @springmeyer it sounds like pretty significant mapnik limitations, and I would be a serious noob jumping in, but there could be some nice gains for styling and analysis of elevation data. Is it worth the commitment?

@springmeyer
Copy link
Contributor

Yes @rclark I think its worth it. I'll need to mull on a best way to open this door in mapnik...

@rclark
Copy link
Contributor

rclark commented Jun 20, 2014

@springmeyer: is there any reason we can't pass single-band rasters around as buffers inside vector tiles? If I'm understanding the limitation here is that mapnik.Image.encode always generates rgba images?

@springmeyer
Copy link
Contributor

@springmeyer: is there any reason we can't pass single-band rasters around as buffers inside vector tiles?

No, this should work fine.

If I'm understanding the limitation here is that mapnik.Image.encode always generates rgba images?

Correct the limitation is that the single band rasters are currently converted to 32 bit rgba images in mapnik-vector-tile which may or may not preserve the original pixel values in a way they will be usable later. Needs testing to see how much we can get away with before adding support for single band tif.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants