Open szylinski-sa opened 2 weeks ago
Can you share the data and the code to reproduce this?
Data (single tif) zipped here. This has been quickly clipped down in ArcGIS because the data is sensitive but roughly matches the extent shown in the image. it behaves exactly the same - 1s and 0s appear correctly but what should be NA - and are transparent cells - is showing as 255. Edit- and interrogating the file in Arc confirms that the cells outside the 0/1 area are no value.
Code used is as above -
filepath <- "clip.tif"
leaflet() %>%
addProviderTiles("Esri.WorldImagery",
group = "Esri imagery") %>%
addGeotiff(file = filepath,
layerId = "tif")
Ok, thanks! The reason for the 255 is that this is the NoData
value set in the tif file. I need to think about whether it makes sense to show these as NA
in R (it probably does).
This is the relevant part of gdalinfo clip.tif
Thanks, had a feeling it was baked into the file somehow. Any advice or workaround for dealing with this in the meantime? E.g terra::values
on terra::rast(filepath)
returns NA rather than 255 but not sure if that's useful.
I'm using addGeotiff to map a masked raster:
Using the mouse to hover over the raster and get the pixel values is great, and here it correctly returns my 1 and 0 values in the coloured section. However as the image below shows, the value returned for NA pixels is 255. Is it possible to set the value shown to 'NA' here, or turn off the counter entirely as is the case when hovering over a non-raster area?
There's also a transparent grid visible for this area which would be nice to be able to hide (though less of an issue than the pixel values).