I have a shapefile (polygon) that I want to rasterize by an attribute but the rasterize tool does not recognize the right field. When I create a new field using the field calculator it does not matter what type I choose (integer, real, ...) the result is qlonglong (integer64), a type that the rasterize tool apparently does not recognize.

  • Which QGIS version do you use? Sounds like a bug report – underdark May 14 '17 at 17:28
  • I am running Qgis 2.18.7. I solved the problem using the rasterize tool from the processing toolbox. However the fact that the filed calculator seems to ignore the "type" you choose when creating a new field seems like a bug to me. – Konstantin_o May 15 '17 at 15:42

Here is a list of fields that contains different type of fields: integer, String, and qlonglong (integer64).

enter image description here

If you access the Rasterize tool from Raster -> Conversion -> Rasterize (Vector to raster) you will see only the fields that are integer type.

enter image description here

To get integer type not qlonglong (integer64), the length should be from 1 to 9 when you define a new field, as you can see below:

enter image description here

However, if you accessed the Rasterize (Vector to raster) tool from Processing toolbox -> GDAL/OGR -> [GDAL] Conversion -> Rasterize (Vector to raster), you will get every type in the attribute table even the string type, as you can see below:

enter image description here

My recommendation is to use the rasterize tool from Processing toolbox.

  • Thanks for the hint. The Rasterize (Vector to raster) tool from Processing toolbox reads other types than "int". – Konstantin_o May 15 '17 at 15:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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