7

I'm looking to classify regions on a map by the amount of light pollution in the area. I have the varied intensities (0 through 60) plotted using a color map, but is there anyway that instead of a spectrum of colors I can have the numerical output instead?

So in place of the different colors of blue as shown in the screen shot below, I would be able to see different numbers inside every pixel on the map.

Color per Pixel Example

If I could even get GIS to display the 'value' or 'label' rather than the 'color' that would be everything I'm asking for.

Layer Properties Example

I feel like the solution should be easy, but I'm pretty stuck.

ahmadhanb
  • 40,826
  • 5
  • 51
  • 105
aylagtr
  • 81
  • 1
  • 2

1 Answers1

2

This can be done by converting the raster data into point shapefile, but I could not find a correct tool in QGIS, so I used a workaround method to convert the raster data into a text file using the GRASS tool of r.out.xyz, then you can import that text file as point data using Add delimited text layer. Here is how it works:

  • I have the following raster data, which is just a small subset:

enter image description here

  • I used GRASS tool: r.out.xyz - Exports a raster map as a list of x,y,z values into an ASCII text file, used comma as a Field separator, and saved the text file into the hard disk:

enter image description here

  • I used Add delimited text layer and used comma as the separator:

enter image description here

  • I Used Show Labels for this layer based on the field_3 which contains the z values of (Raster cell values). To make it efficient, I restricted labels to be shown at maximum scale of 5000. A value higher than 5000 makes the labels disappear.

  • Then hide the point symbol using Style -> No Symbols:

enter image description here

  • Here is the output:

enter image description here

But frankly speaking this will produce a huge text file. The size of the above text file is about 11.5 megabyte and the image is small. This makes rendering labels may take some time depending on the RAM of your computer.

ahmadhanb
  • 40,826
  • 5
  • 51
  • 105