1

I am wanting to use FWTools to rasterize a large number of Shapefile polygons. I have used the Rasterize tool in QGIS and it works great. But when I use the generated code in FWTools the process does not work. Here is the generated code:

gdal_rasterize -a COVTYPE -ts 5000 3705 -l LCC001k_dis
C:/GlobalData/Vectors/LCC/LCCRasters/LCC001k_dis.shp
C:/GlobalData/Vectors/LCC/LCCRasters/LCC001k.tif

Unfortunately, I am not a programmer, so I am not able to create my own script to perform this task. Can anyone assist me with why this code doesn't work in FWTools, or what changes I need to make to utilize the Rasterize functionality.

4
  • Do you get any errors or other output when running the code command?
    – dakcarto
    Commented Jun 4, 2012 at 13:54
  • No there is no error message. It just brings up the usage. Commented Jun 4, 2012 at 14:15
  • It would be good to mark an answer to this and previous questions as "accepted" by clicking the checkmark next to the answers. Commented Jun 4, 2012 at 15:28
  • FWTools uses an outdated gdal library, use binaries at gisinternals.com/sdk or QGIS.
    – user10353
    Commented Dec 19, 2012 at 22:40

1 Answer 1

2

In my version of FWTools I don't think your command line would work either, it expects the raster to which you are burning the vectors to exist already. The version of gdal_rasterize that comes with recent versions of QGIS does not have this limitation, it can create the new raster. Nick.

6
  • Thanks Nick. That was my suspicion, but I wanted to see if there was something I was missing. Do you know of any other way I may be able to do this via a command line? I want to batch the rasterization of hundreds of files. Commented Jun 4, 2012 at 15:12
  • If you're in Windows you could run gdal_rasterize from an OSGEO4W window. Or from any command line window, if you put in the path to the QGIS version of gdal_rasterize. Nick.
    – nhopton
    Commented Jun 4, 2012 at 15:20
  • I just tried that with the same result: C:\Program Files (x86)\FWTools2.4.7>"C:\Program Files (x86)\Quantum GIS Wroclaw\bin\gdal_rasterize.exe" gdal_rasterize -a COVTYPE -ts 5000 3705 -l LCC001k_dis C:/GlobalData/Vectors/LCC/LCCRasters/LCC001k_dis.shp C:/GlobalData/Vectors/LCC/LCCRasters/LCC001kz.tif Commented Jun 4, 2012 at 15:29
  • "...\bin\gdal_rasterize.exe" gdal_rasterize..." It looks as if you're calling gdal_rasterize twice :( Nick.
    – nhopton
    Commented Jun 4, 2012 at 15:43
  • Thank you Nick, those second pair of eyes helped. That was it. Thanks again. Commented Jun 4, 2012 at 16:00

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.