Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I try to show a small resolution raster file in the QGIS Print Manager tool. I would like to show a small label with each cell value (position - circa middle of each cell).

How I can do it? Is there any plugin which can help me to accomplish this task?

My idea is to use gdal2xyz, load such file using CSV plugin and then save it as a vector file. Unfortunately it is much work, because I have many raster files.

Another idea is to use, then ogr2ogr to save it as vector file.

Is there any way to batch this process? Is there any open-source program where I can do it much more easily?

share|improve this question
Do you mean something like this? There is already feature request for this functionality. – Tomas Jul 20 '13 at 21:26

There doesn't seem to be a plugin for or functionality in QGIS to label cells.

Using a converted vector file to label the centres of the cells is probably your best bet. The open-source statistics package R has a lot of excellent spatial tools and can batch or quickly process raster files to create shapefiles (vector/points).


# Load the raster from a file
r <- raster("/workspace/TEMP/raster.asc")

# Convert to spatial points
p <- as(r, "SpatialPointsDataFrame")

# Save as a shapefile
writeSpatialShape(p, "/workspace/TEMP/raster_points")

The shapefile will have column with the raster values for each point. The points can then be loaded into QGIS, given a size of 0 and labelled appropriately; they appear in the centre of cells.

To go through, for example, all the TIF files in a directory:

for (file in dir("/workspace/TEMP/", pattern="*.tif")) { # list all .tif files
  r <- raster(file)
  p <- as(r, "SpatialPointsDataFrame")
  writeSpatialShape(p, substr(file, start = 1, stop = nchar(file) -4)) # substr() removes extension.
share|improve this answer
+1 Great answer: thanks for sharing! – whuber Nov 28 '11 at 22:47

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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