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

Error when source has alpha band #26

Closed
andrewharvey opened this issue Dec 1, 2016 · 8 comments
Closed

Error when source has alpha band #26

andrewharvey opened this issue Dec 1, 2016 · 8 comments
Assignees
Labels
Milestone

Comments

@andrewharvey
Copy link

When I run the following:

rio --verbose mbtiles --force-overwrite --title ''  --description '' --overlay --format PNG --zoom-levels 1..20 -j 4 --src-nodata 0 raster.tif output.mbtiles

where raster.tif has an Alpha band

For example using NE2_50M_SR and running:

gdalwarp -of GTiff -dstalpha NE2_50M_SR/NE2_50M_SR.tif raster.tif

creating a 4th alpha band:

Band 1 Block=10800x1 Type=Byte, ColorInterp=Red
  Mask Flags: PER_DATASET ALPHA 
Band 2 Block=10800x1 Type=Byte, ColorInterp=Green
  Mask Flags: PER_DATASET ALPHA 
Band 3 Block=10800x1 Type=Byte, ColorInterp=Blue
  Mask Flags: PER_DATASET ALPHA 
Band 4 Block=10800x1 Type=Byte, ColorInterp=Alpha

rio produces the output:

Traceback (most recent call last):
  File "/usr/local/bin/rio", line 11, in <module>
    sys.exit(main_group())
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 716, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 696, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 1060, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 889, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 534, in invoke
    return callback(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/click/decorators.py", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/mbtiles/scripts/cli.py", line 187, in mbtiles
    for tile, contents in pool.imap_unordered(process_tile, tiles):
  File "/usr/lib/python2.7/multiprocessing/pool.py", line 668, in next
    raise value
IndexError: tuple index out of range
@sgillies
Copy link
Contributor

sgillies commented Mar 1, 2017

@andrewharvey I found a couple blockers for this in Rasterio: rasterio/rasterio#984 rasterio/rasterio#985. I'll update here when those are fixed. Will require a Rasterio upgrade.

@sgillies sgillies added this to the 1.4.0 milestone Mar 1, 2017
@sgillies sgillies added the bug label Mar 1, 2017
@qxang
Copy link

qxang commented Aug 16, 2017

@andrewharvey Do you fix the problems? and how?

@andrewharvey
Copy link
Author

@andrewharvey Do you fix the problems? and how?

@Shanyuk nope. Alternatives are https://github.com/mapbox/mapbox-tile-copy and then download tiles from S3 and use https://github.com/mapbox/mbutil to pack them into an MBTiles (which I think should give you the same result as uploading your GeoTIFF as is to Mapbox), or just upload directly to Mapbox.

@qxang
Copy link

qxang commented Aug 16, 2017

Thank you. I will have a try.

@qxang
Copy link

qxang commented Aug 16, 2017

@sgillies sgillies modified the milestones: 1.4.0, 1.5.0 Nov 14, 2017
@sgillies
Copy link
Contributor

Kicking this to a future milestone. 1.4.0 is coming sooner than I can make the rasterio fix.

@sgillies sgillies modified the milestones: 1.5.0, 1.4.2 Mar 6, 2019
@sgillies sgillies self-assigned this Mar 6, 2019
@sgillies
Copy link
Contributor

sgillies commented Mar 6, 2019

New milestone: 1.4.2 cc @jacquestardie

sgillies pushed a commit that referenced this issue Mar 6, 2019
sgillies added a commit that referenced this issue Mar 7, 2019
* Tests that reproduce #26

* Add support and tests for RGBA PNG output

* Update dev requirements

* Use requirements-dev.txt on Travis

* Revert to pytest 3.8 to avoid warnings

* Use sqlite3.Binary

* Add CoC and update readme
@sgillies sgillies closed this as completed Mar 7, 2019
@sgillies
Copy link
Contributor

sgillies commented Mar 7, 2019

Resolved and will be available in 1.4.2 (on PyPI later today). New usage is explained in the README and rio mbtiles --help.

@sgillies sgillies mentioned this issue Mar 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants