Replace colour of pixel in one layer with colour of pixel in another layer
in Raster Data
Hi there,
I have two GeoTIFF files of land cover in a location. One file is at 10m resolution while the other is at 30m resolution. I would prefer to use the 10m resolution file, however it is less accurate than the 30m file. In particular, the 10m file renders some building shadows as "water", while the 30m file correctly classifies them as "urban".
What I would ideally like to do is set up a script or formula that checks every pixel in the 10m file against the same pixel location in the 30m file and replaces the colour if it's not the same. So my pseudo code would be something like this:
Var 10m_file
Var 30m_file
Pixel = (0,0)
If 10m_file Pixel(RGB) == (0,0,255) AND 30m_file Pixel(RGB) == (255,0,0) {
10m_file Pixel(RGB) = (255,0,0)
}
Pixel++
Note that "urban" is red in the above code, and I have ommitted more appropriate iteration over all pixel co-ordinates in the file in a for loop, but you get the gist.
Is something like this possible in Global Mapper?
I have two GeoTIFF files of land cover in a location. One file is at 10m resolution while the other is at 30m resolution. I would prefer to use the 10m resolution file, however it is less accurate than the 30m file. In particular, the 10m file renders some building shadows as "water", while the 30m file correctly classifies them as "urban".
What I would ideally like to do is set up a script or formula that checks every pixel in the 10m file against the same pixel location in the 30m file and replaces the colour if it's not the same. So my pseudo code would be something like this:
Var 10m_file
Var 30m_file
Pixel = (0,0)
If 10m_file Pixel(RGB) == (0,0,255) AND 30m_file Pixel(RGB) == (255,0,0) {
10m_file Pixel(RGB) = (255,0,0)
}
Pixel++
Note that "urban" is red in the above code, and I have ommitted more appropriate iteration over all pixel co-ordinates in the file in a for loop, but you get the gist.
Is something like this possible in Global Mapper?
Howdy, Stranger!
Categories
- 12.3K All Categories
- 5.3K Features Discussion
- 312 Downloading Imagery
- 1.2K Elevation Data
- 374 Georeferencing Imagery Discussion
- 582 GM Script Language
- 42 User Scripts
- 112 GPS Features
- 388 Projection Questions
- 790 Raster Data
- 1.3K Vector Data
- 6.4K Support
- 160 Announcement and News
- 882 Bug Report
- 555 SDK
- 1.1K Suggestion Box
- 3.6K Technical Support
- 523 Other Discussion
- 126 GIS Data Sources
- 26 Global Mapper Showcase
- 217 How I use Global Mapper
- 101 Global Mapper Forum Website