How to use GeoTIFFs for Image Color Components - Heron

Hi, what exactly is the workflow when using GeoTIFFs and extracting color values? Heron has components for importing rasters and reading colors from rasters. However the latter component expects a file format other than a .tif…the component works with .jpg/.png and the output is as expected but how am I supposed to convert a .tif to a .jpg/.png? Will I have to do this process outside of grasshopper and import those images using the rasterExtent?

P.S. I am using GeoTIFFs from Google’s Open Building 2.5D Dataset

Hi -

Just to make sure, what is the expected output?
AFAIK, a GeoTIFF is basically a heightfield and grayscaled. You can probably remap the grayscale values to a different gradient.

As for Heron, CC @Brian_Washburn
-wim

If my image is this (took a screenshot from open buildings)

Expected output is this - A pointcloud with values that I can extract using the color scale

Here is the GH file
raster image to pointcloud with color.gh (10.0 KB)

Hi @Kyuubimode ,
Can you post a link to the geotiff you’d like to use for testing?
-Brian

Hi Brian,

Sure here you go - https://drive.google.com/file/d/1WGll-mK6AcgFIvE0Y0e1VM6z88U8zGnN/view?usp=sharing

Each geotiff is 25000 x 25000 pixels large and some geotiffs go up to 1GB. I have uploaded a 100MB one in my drive. Also, the location is Mumbai (if you need to set an EAP)

Hi @Kyuubimode ,
Inspecting this geotiff in Qgis, it appears to have 3 bands corresponding to “building_fractional_count”, “building_height”, and “building_presence” and is not an RGB gradient of color as seen in your screenshot examples.

If you want to extract one of these bands, you can use GdalTranslate. The image below shows extracting Band 2 “building_height” as an example.

If you are actually looking for building heights, you can use the extracted band 2 to drive the ImportTopo component as shown here:


If you are looking for a color gradient as seen in your screenshots, this would require a couple more steps:


Here is the GH definition I’m using
raster image to pointcloud with color_BW.gh (32.6 KB)

Does this help?

-Brian

1 Like

Hi @Brian_Washburn thank you I need exactly what you have showed me. However I am having some trouble setting up the definition here on my end.

Every time I use the Import Raster component I realized that it is actually not saving the clippedRaster to the destination file. It is only saving the preview png file but not the clipped tif.

And I get this breakpoint when I attempt to attach a new wire to the Clipped Location file directory input

Are the file sizes of the rasters an issue?

Hi @Kyuubimode ,
File size shouldn’t be an issue. Can you post a link to this geotiff so I can verify?
-Brian