3

I have successfully combined a shapefile (.shp) and a GeoTiff using gdal_rasterize.

The shapefile displays as one pixel wide in the GeoTiff, but I need it to be wider and more visible, say, 5 pixels wide and red.

Can anyone suggest an alternate way to achieve this? This needs to run as a script and not use desktop gis software.

1 Answer 1

2

You can calculate a buffer directly with ogr2ogr using GDAL >= 1.10 with SQLite and SpatiaLite support. If the raster spatial resolution is e.g. 1m:

ogr2ogr -dialect SQLite -sql "SELECT ST_Buffer(geometry,2.5) FROM lines" buffer_lines.shp lines.shp

Finally, you can adapt and apply the first example of gdal_rasterize documentation:

gdal_rasterize -b 1 -b 2 -b 3 -burn 255 -burn 0 -burn 0 -l buffer_lines buffer_lines.shp work.tif
2
  • afalciano - I will give this a try! Thank you for the help.
    – cm1
    Dec 17, 2013 at 15:51
  • Once I got the gdal configuration sorted, this worked perfectly.
    – cm1
    Dec 19, 2013 at 17:13

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.