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

[FEATURE]: Enable COG creation #163

Open
nrweir opened this issue Jun 24, 2019 · 7 comments
Open

[FEATURE]: Enable COG creation #163

nrweir opened this issue Jun 24, 2019 · 7 comments

Comments

@nrweir
Copy link
Contributor

nrweir commented Jun 24, 2019

Currently COGs can't be created from within solaris. I did try to implement it, but ran into an error when I tried to do so:

RasterioIOError: Read or write failed. Writing through VRTSourcedRasterBand is not supported.

This was a GDAL CPLE_-originating error. Googling around, this seems like it's not restricted to rio_cogeo, but the way writing is implemented in rio_cogeo could be the source of it. Alternatively, it could be an issue with the fact that I have both GDAL python bindings and rasterio installed in the environment. I got the same error when I just tried to run rio_cogeo.cogeo.cog_translate() directly in a Jupyter notebook on a GeoTIFF (not within the solaris functionality).

Two things I need to do to test this:

  1. create a new conda environment with no GDAL installed outside of rasterio and rio_cogeo, and see if I still have the same issue. If not, then this is likely a consequence of installing both GDAL and rasterio and we'll need to figure out how to resolve that.
  2. If the above doesn't fix the problem, submit an issue to the rio_cogeo repository.
@vincentsarago
Copy link

@nrweir I'll have a look, please feel free to tag me on any rio-tiler/rio-cogeo/rasterio issues

@vincentsarago
Copy link

started to have a look and I noticed multiple problems:

dst_kwargs={'crs': CRS.from_epsg(self.dest_crs)},

dst_kwargs is misleading. This option should be populated with COG profile as seen in https://github.com/cogeotiff/rio-cogeo/blob/master/rio_cogeo/scripts/cli.py#L161-L175

Sadly this doesn't allow reprojection. If you really need to work in another projection you'll need to create a temporay file. Rio-cogeo as also a native --web-optimized option that will create WebMercator aligned COG (web_optimized=True + latitude_adjustment=False if working with local dataset)

FYI: here is an example how to use cog_translate outside rio-cogeo https://github.com/vincentsarago/cog-translator/blob/46499244b81bb5df044e90c47cceb4a5daeeecaa/cog_translator/__init__.py#L41-L66

@nrweir
Copy link
Contributor Author

nrweir commented Jul 2, 2019

Thanks for this @vincentsarago. The intention wasn't necessarily to re-project - the source file should already be in that CRS (in effect the source file is a temp file) - I think I'd skimmed the cog_translate() code too quickly and thought that the --web-optimized hard-coding of CRS applied to any output, not only cases using that flag.

@nrweir
Copy link
Contributor Author

nrweir commented Jul 9, 2019

@vincentsarago, have you ever thought about putting a conda package up for rio-tiler? I'm working on getting a conda build for this project and am trying to nail down the last few dependencies that I can't find in any channels.

@vincentsarago
Copy link

👋 @nrweir

have you ever thought about putting a conda package up for rio-tiler

No I never thought about this because I know almost nothing about conda. I'll open an issue on rio-tiler and rio-cogeo

@nrweir
Copy link
Contributor Author

nrweir commented Jul 9, 2019

@vincentsarago thanks for the super prompt reply - I'm happy to help out with that, I've put together packages for conda-forge before.

@vincentsarago
Copy link

@nrweir excellent, yes please feel free to share any tips or open a PR 😄

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

No branches or pull requests

2 participants