3

Given a discrete band, and say an area that for example all has the value 5, is there a way in which I can highlight or differentiate where pixels start and stop?

This doesn't have to be some permanent differentiator among all pixels like some corner marking (although that might be helpful), even something that can just visually highlight the pixel I'm clicking on. I'm probably overlooking something simple but have been searching for a while and cannot find a solution.

1
  • That selects the pixel, but it doesn't seem to visually highlight it. So I can't get a sense of where the pixel starts and ends. I may not have correct settings if that is a possibility. I am using that tool currently though as a workaround. I created another continuous band on the raster so that clicking around, I can use where that other band changes to know its a new pixel, but I'm sure there must be a better way than what I'm doing.
    – mbase
    May 2, 2021 at 17:30

2 Answers 2

3

One option is using "Raster pixels to polygons" from the Processing Toolbox. It creates a new vector layer containing a polygon for each pixel. If you remove the symbol fill, you will get the boundary:

enter image description here

1
  • This is perfect functionally for what I want. Is there a way I can essentially take what is in that polygon layer or something equivalent and make it just a visual thing? I'm working with large rasters and its rendering 5 million polygons by feature count which is introducing a little bit of lag.
    – mbase
    May 2, 2021 at 18:21
0

Consider trying the QGIS > Raster > Conversion > Polygonize (Raster to Vector) tool. Where adjacent raster cells contain the same value (in your example, the value 5), this tool dissolves out their shared boundary, resulting in fewer output polygons. Taken to its logical extreme, if all of the raster cells contain the same value, the vector output will contain only the outer boundary.

Sidenote discussion: In my experience with both QGIS and Arc desktop, converting rasters to vectors will often result in output that has geometry errors. I've never bothered to find out what those errors are because QGIS has the very speedy and effective tool Fix Geometries. This is a "black-box" operation in that you simply supply the vector layer's name and the tool does the magic wash. Thus, I always run Fix Geometries after a raster-to-vector conversion. If I knew how to code, I suppose that I could open up the tool's hood and see what's going on underneath. Arc desktop has a similar tool, Repair Geometry, but I've had situations (admittedly few) where it failed to completely fix things, which were subsequently solved by "Fix Geometries". I'm at QGIS 3.18.2 and Arc 10.8.1.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.