mapbox / mapbox-studio-classic

https://www.mapbox.com/mapbox-studio/
BSD 3-Clause "New" or "Revised" License
1.14k stars 229 forks source link

Can't open GeoTIFF with DEFLATE or JPEG compression #1405

Open andrewharvey opened 9 years ago

andrewharvey commented 9 years ago

Error: Error creating Mapnik Datasource: Invalid raster: could not open the file when trying to load in a GeoTIFF with DEFLATE compression (-co COMPRESS=JPEG also has the same issue, but LZW works).

Tested on latest mapbox-studio from git, although issue is probably in underlying library?

To reproduce,

$ wget http://naciscdn.org/naturalearth/50m/raster/HYP_50M_SR.zip
$ unzip HYP_50M_SR.zip

Open HYP_50M_SR.tif in Mapbox Studio, works fine.

$ gdal_translate -of GTiff -co COMPRESS=DEFLATE HYP_50M_SR.tif HYP_50M_SR_DEFLATE.tif

Open HYP_50M_SR_DEFLATE.tif in Mapbox Studio, gives Error: Error creating Mapnik Datasource: Invalid raster: could not open the file, with the following logged:

GDAL: GDALOpen(/mnt/host/HYP_50M_SR_DEFLATE.tif, this=0x11bb100) succeeds as GTiff.
OGR: OGROpen(/mnt/host/HYP_50M_SR_DEFLATE.tif) failed.
GDAL: GDALClose(/mnt/host/HYP_50M_SR_DEFLATE.tif, this=0x1410ba0)
 error 500 { [Error: Error creating Mapnik Datasource: Invalid raster: could not open the file]
  code: 'EINVALID',
  method: 'GET',
  url: '/metadata?file=/mnt/host/HYP_50M_SR_DEFLATE.tif' }
springmeyer commented 9 years ago

are you seeing this on a 64 bit linux machine?

andrewharvey commented 9 years ago

are you seeing this on a 64 bit linux machine?

@springmeyer Yes

springmeyer commented 9 years ago

Thanks. I'm unable to replicate on OS X locally. So it must be something specific about the way I'm building GDAL on linux. Hmmm....

andrewharvey commented 9 years ago

Thanks. I'm unable to replicate on OS X locally. So it must be something specific about the way I'm building GDAL on linux. Hmmm....

I'm using my own build rather than the precompiled binary, so I'll do some more tests to see if it's something to do with my build and compare with the official precompiled.

springmeyer commented 9 years ago

I'm using my own build rather than the precompiled binary

Oh. Good to know. I also just tried to replicate on linux and could not. It seems likely this is a build issue on your end then if you are not using the precompiled node-mapnik.

andrewharvey commented 9 years ago

I just tried the official mapbox-studio-linux-x64-v0.2.7.zip build on a Debian Jessie VM and this time, the original HYP_50M_SR.tif works, but the one with DEFLATE compression now gives the error Error: Invalid gdal source. Error opening dataset.

I don't even have system gdal libraries installed, so I don't think it's conflicts there.

I'll try it on an Ubuntu 15.05 64bit VM and see what happens to try to narrow down when it's occurring.

andrewharvey commented 9 years ago

I'll try it on an Ubuntu 15.05 64bit VM and see what happens to try to narrow down when it's occurring.

On a clean Ubuntu 15.05 64bit VM with the official mapbox-studio-linux-x64-v0.2.7.zip build, the original HYP_50M_SR.tif works, but the one with DEFLATE compression now gives the error Error: Invalid gdal source. Error opening dataset..

wilhelmberg commented 9 years ago

Same error message (Error: Invalid gdal source. Error opening dataset.) with Mapbox Studio 0.2.7 on Windows.

wilhelmberg commented 9 years ago

I adjusted gdal-tiling-bench to this test case and node-mapnik@3.1.4 doesn't seem to have a problem with the deflated file.