gridviz icon indicating copy to clipboard operation
gridviz copied to clipboard

visualize tif ?

Open palmajoao opened this issue 1 year ago • 4 comments

@joewdavies et al, once again this is great stuff! keep up the great work!

Would love to use the GridViz to display some grids and I have a 100m resolution tif that even if I rescale it to 1k yields about 200MB as a CSV. As a tif, it has about 2MB ...

I see that you have some tif files in your assets: https://github.com/eurostat/gridviz/tree/master/assets/tiff/test

CSVs can be very inefficient as they repeat coordinates of the regular grid. An ASC file would reduce that size a little as the first rows define the grid.

But I can't see any reference to the tif assets usage. Are you planning to have some methods to visualize it?

palmajoao avatar Mar 14 '24 18:03 palmajoao

Hi Joao !

There is currently no (direct) support for tif format with gridviz. We did some testing here: https://github.com/eurostat/gridviz/blob/master/src/dataset/GeoTIFF.js using geotiff.js library (https://geotiffjs.github.io/) and it did not happen to be so relevant because tiff files are usually quite large. COG format (https://www.cogeo.org/) could be a good solution (allowing tiling a tiff file and downloading only part of it) but still has strong limitations.

The only operational option is either with a small CSV file, or a bigger one which can be tiled to improve efficiency. This dedicated gridtiler tool allows decomposing large CSV files into smaller chunks: https://github.com/eurostat/gridtiler to tile it and use it with gridviz.

To transform a big tiff file into tiled CSV format used by gridviz, we developped some processes in java for 100m resolution data over Europe. See this example for copernicus data: https://github.com/eurostat/JGiscoTools/blob/dev/modules/gproc/src/main/java/eu/europa/ec/eurostat/jgiscotools/gisco_processes/gridvizprep/EurElevation.java but this was not (yet) exposed as a reusable process unfotunatelly. It should come soon !

jgaffuri avatar Mar 15 '24 11:03 jgaffuri

For TIFF support in gridtiler, see https://github.com/eurostat/gridtiler/issues/3

jgaffuri avatar Mar 15 '24 11:03 jgaffuri

If your data is freely available, let use know how we could use it as a test case !

jgaffuri avatar Mar 15 '24 11:03 jgaffuri

@jgaffuri been trying with the gridtiler and programatically works fine. But the 1k resolution still loads slowly, so I was playing with the aggregation function but was rendering weird values... and while digging the gridtiler issues I found this https://github.com/eurostat/gridtiler/issues/7 which made me understood the reason for the weird values.

our data can't be summed when aggregated as it looses meaning. Our data would need to have the MAX (or MODE) of the values in the aggregation, i.e. for each gridcell we have "number of pressures" ranging from 1 to 14. It dos not make sense to sum all gridvalues as it yields a meaningless value. Do you think https://github.com/eurostat/gridtiler/issues/7 is an easy fix so we can pursue the use of gridviz?

palmajoao avatar Mar 15 '24 19:03 palmajoao