7

When using the GDAL "Polygonize (raster to vector)" any values in the resulting vector layer is truncated to integer.

I have a raster showing windspeeds in squares of 500*500 meters, in the metadata-field i read that the lowest value is 2.5899999142 and the highest value is 12.6599998474. Then when polygonizing, the result layer only has values: 0, 1, 2, 3... and so on. No decimals.

I have googled the issue and found this: http://trac.osgeo.org/postgis/ticket/650 Don't know if it helps though.

5

Perhaps you could multiply your wind speed values using the raster calculator, by 10 if you want to keep the value to 1 decimal place, then export the result to polygon, add a new field to your polygon layer and use the calculator to populate its values by dividing the raster value by 10

1
  • 1
    Yes! I can verify that this will work! Thank you for your answer. I have to say though, that even if this will do the job, I think it is kind of a workaround and this should be fixed in a future update.
    – Patrik
    Aug 12 '13 at 11:26
1

There is a version now of gdal_polygonize that has an option to avoid rounding by using --float. I know this is an old question but these older versions of gdal_polygonize are still around. You should be able to replace the older version with the new one. Information is here :

https://trac.osgeo.org/gdal/attachment/ticket/4516/gdal_polygonize.py

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.