Code Monkey home page Code Monkey logo

Comments (9)

vincentsarago avatar vincentsarago commented on May 24, 2024

Thanks @alon this is interesting. I'll have a look at it

from rio-cogeo.

alon avatar alon commented on May 24, 2024

from rio-cogeo.

vincentsarago avatar vincentsarago commented on May 24, 2024

@alon

Is it possible to serve a COG without a tiling service

Absolutely, I'm usually using https://github.com/cogeotiff/rio-tiler (and https://github.com/vincentsarago/lambda-tiler) to do this but you could also check https://github.com/DHI-GRAS/terracotta or https://github.com/mojodna/marblecutter which provide the full architecture.

That's said, if you have int16 dataset you'll need custom script to rescale your data to int8.

from rio-cogeo.

vincentsarago avatar vincentsarago commented on May 24, 2024

@alon This is a rasterio problem and I'm not sure if there is a way around it.

Basically rasterio.shutil.copy https://github.com/mapbox/rasterio/blob/master/rasterio/shutil.pyx#L56 is swallowing GDAL warnings but I don't think there is a way to fix that.

cc @sgillies

from rio-cogeo.

sgillies avatar sgillies commented on May 24, 2024

@vincentsarago the errors occur during the execution of GDALCreateCopy at https://github.com/mapbox/rasterio/blob/master/rasterio/shutil.pyx#L137, right? Because we've released Python's global interpreter lock, the errors cannot be turned into exceptions. It might be possible to create a GDAL error handler that would break out of GDALCreateCopy and the nogil block using setjmp and longjmp, but I've never done that in Cython before and I'm hesitant to do so 😰 Validating the data type before copying is probably the best solution.

from rio-cogeo.

vincentsarago avatar vincentsarago commented on May 24, 2024

@sgillies thanks for the investigation.
That's said, I think GDAL doesn't throw error but just warnings (ERROR 1: JPEGSetupEncode:BitsPerSample 16 not allowed for JPEG)

Validating the data type before copying is probably the best solution

Yeah I think this is what we should do 🙏

from rio-cogeo.

vincentsarago avatar vincentsarago commented on May 24, 2024

🤔 @sgillies I've just encountered this with other options

# This command runs find but the result is empty (data is not copied)
$ rio cogeo create float64.tif float64cog.tif --co BLOCKXSIZE=256 --co BLOCKXSIZE=256 --cog-profile deflate --co ZLEVEL=6 --co PREDICTOR=2

while with gdal 
gdal_translate  float64.tif float64cog.tif -co BLOCKXSIZE=256 -co BLOCKYSIZE=256 -co COMPRESS=DEFLATE -co ZLEVEL=6 -co PREDICTOR=2
Input file size is 301, 520
0...10...20...30...40...50...60...70...80...90...100 - done.
ERROR 1: PredictorSetup:Horizontal differencing "Predictor" not supported with 64-bit samples
ERROR 1: PredictorSetup:Horizontal differencing "Predictor" not supported with 64-bit samples
ERROR 1: WriteEncodedTile/Strip() failed.
ERROR 1: PredictorSetup:Horizontal differencing "Predictor" not supported with 64-bit samples
ERROR 1: WriteEncodedTile/Strip() failed.
ERROR 1: PredictorSetup:Horizontal differencing "Predictor" not supported with 64-bit samples

I feel there are a lot of corner case I'll need to check ...

from rio-cogeo.

alon avatar alon commented on May 24, 2024

@alon

Is it possible to serve a COG without a tiling service

Absolutely, I'm usually using https://github.com/cogeotiff/rio-tiler (and https://github.com/vincentsarago/lambda-tiler) to do this but you could also check https://github.com/DHI-GRAS/terracotta or https://github.com/mojodna/marblecutter which provide the full architecture.

Right, I understand it is doable with a service which creates the tiles on demand, and then serves them:
COG -> TILER -> FRONTEND
And showing the artifacts:
COG: single file on disk
TILER: in memory / cached on disk tiles (png per X/Y/Z)

But I'd like to forgoe the tiler, and have
COG -> FRONTEND
where the arrow signifies HTTP traffic.

My current flow is:
Preprocessing: TIFF (not COG) -> tiles -> cloud (azure)
CLOUD -> FRONTEND (via leaflet)
The tiling stage is very slow, I'm using gdal2tiles with zoom levels 18, which is brutal for a 50k x 20k image, even though most of it is NODATA.

@vincentsarago I would happily discuss this offline, or publically but on a more appropriate place than this ticket :) I'm alon at pobox dotcom

from rio-cogeo.

vincentsarago avatar vincentsarago commented on May 24, 2024

@alon

COG -> FRONTEND

checkout https://github.com/geotiffjs/geotiff.js

I would happily discuss this offline, or publically but on a more appropriate place than this ticket :) I'm alon at pobox dotcom

We have a #cogeotiff Chanel on thespatialcommunity slack -> https://thespatialcommunity.org

from rio-cogeo.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.