Following problem has troubled me for two days now and I can't find a solution:

I am using QGIS to generate contour lines from SRTM DEMs. Export these as shapefiles and load them into TileMill on top of a GeoTIFF.

Problem: I can't seem to get rid of the ".0" end of each height (see picture).

enter image description here

This is the carto.css I use:

#kueste_1000 [zoom>=12]{
  text-name: [ELEV];
  text-face-name: @sans_italic;
  text-fill: #c6b69b;
  text-placement: line;
  text-min-distance: 400;
  text-size: 12;

I have different contour shapefiles, generated years ago by dem2topo, labelling these works fine.

I thought the problem might be caused by the attribute label, but changing (in gdal_contour command line) the name of the attribute from ELEV to NAME or anything else doesn't do the trick.

I also tried to change the gdal_contour command line:

gdal_contour ... -i 1000.0


gdal_contour ... -1 1000

but this also didn't work.

The funny part is that QGIS, when setting the flag to label these lines, does so without the .0

enter image description here

2 Answers 2


If you do not care about the decimal in the elevation, try to add a new field with name 'Elevation' in QGIS for the contour line with type 'Integer', Then copy the attribute from the 'Elev' field into the 'Elevation' field, and see if that fix the problem.

  • Thanks! This sound very promising. But I have problems copying the 'ELEV' column data into the new column. I definitely need a 'select all data of column' functionality because I have a lot of contours. Can you tell me how this is done?
    – Beres
    Commented Apr 20, 2016 at 12:07


this is how I did it:

Open attribute table - add new column with integer as type. I left lenghtas 1 and chose HEIGHT as its name

Use the field calculator to update an existing field, select the newly created column, e.g. HEIGHT, type "ELEV" in the lower left expression window. Select OK, the old real numbers (with decimals) are now being copied to the newly formed column without decimals. Select this column in tilemill as the one to select values from.

  • Glad it solved the problem, but this is what I explained in my answer to add a new field with integer type then copy your data to the new field.
    – ahmadhanb
    Commented Apr 21, 2016 at 1:08
  • yes, I understand that now =) ..... I had to actually learn how to do that. Initially I was looking for a "select column" by right-mouse-click or so
    – Beres
    Commented Apr 21, 2016 at 1:17
  • Thanks, another thing I've learned - gis.stackexchange.com rules!
    – Beres
    Commented Apr 21, 2016 at 2:27

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.