[gdal-dev] Increase width and change offset of the shape file rasterized

Kyle Shannon kyle at pobox.com
Wed Aug 5 13:41:29 PDT 2015


Gane,

Something similar came up on irc yesterday.  I've recently checked in
a commit that allows the -dialect option in gdal_rasterize.  I don't
think it solves you problem completely, but may help.  Excuse the
verbosity, but a quick example of how to increase your width using the
sqlite dialect and ST_Buffer() on a linestring:

kyle at kyle-bsu-workstation:~/Desktop/tmp$ cat in.csv
WKT,value
"LINESTRING (0 0, 5 5, 10 0, 10 10)",1

kyle at kyle-bsu-workstation:~/Desktop/tmp$ gdal_rasterize -burn 1 -init
0 in.csv -tr 1 1 nobuff.tif
0...10...20...30...40...50...60...70...80...90...100 - done.

kyle at kyle-bsu-workstation:~/Desktop/tmp$ gdal_translate -of aaigrid
nobuff.tif nobuff.asc
Input file size is 10, 10
0...10...20...30...40...50...60...70...80...90...100 - done.

kyle at kyle-bsu-workstation:~/Desktop/tmp$ cat nobuff.asc
ncols        10
nrows        10
xllcorner    0.000000000000
yllcorner    0.000000000000
cellsize     1.000000000000
 0 0 0 0 0 0 0 0 0 0
 0 0 0 0 0 0 0 0 0 0
 0 0 0 0 0 0 0 0 0 0
 0 0 0 0 0 0 0 0 0 0
 0 0 0 0 0 0 0 0 0 0
 0 0 0 0 0 1 0 0 0 0
 0 0 0 0 1 0 1 0 0 0
 0 0 0 1 0 0 0 1 0 0
 0 0 1 0 0 0 0 0 1 0
 0 1 0 0 0 0 0 0 0 1

kyle at kyle-bsu-workstation:~/Desktop/tmp$ gdal_rasterize -burn 1 -init
0 -sql "SELECT ST_Buffer(GEOMETRY, 2) FROM 'in'" -dialect sqlite
in.csv -tr 1 1 buff.tif
0...10...20...30...40...50...60...70...80...90...100 - done.

kyle at kyle-bsu-workstation:~/Desktop/tmp$ gdal_translate -of aaigrid
buff.tif buff.asc
Input file size is 14, 14
0...10...20...30...40...50...60...70...80...90...100 - done.

kyle at kyle-bsu-workstation:~/Desktop/tmp$ cat buff.asc
ncols        14
nrows        14
xllcorner    -2.000000000000
yllcorner    -2.000000000000
cellsize     1.000000000000
 0 0 0 0 0 0 0 0 0 0 0 1 1 0
 0 0 0 0 0 0 0 0 0 0 1 1 1 1
 0 0 0 0 0 0 0 0 0 0 1 1 1 1
 0 0 0 0 0 0 0 0 0 0 1 1 1 1
 0 0 0 0 0 0 0 0 0 0 1 1 1 1
 0 0 0 0 0 0 1 1 0 0 1 1 1 1
 0 0 0 0 0 1 1 1 1 0 1 1 1 1
 0 0 0 0 1 1 1 1 1 1 1 1 1 1
 0 0 0 1 1 1 1 1 1 1 1 1 1 1
 0 0 1 1 1 1 1 1 1 1 1 1 1 1
 0 1 1 1 1 1 0 0 1 1 1 1 1 1
 1 1 1 1 1 0 0 0 0 1 1 1 1 1
 1 1 1 1 0 0 0 0 0 0 1 1 1 1
 0 1 1 0 0 0 0 0 0 0 0 1 1 0

On Fri, Jul 3, 2015 at 6:18 AM, Gane R <gane.prog at gmail.com> wrote:
> Questions: 1. How can I change the width of the vector (shapefile) and
> change the offset.
>
> I see GDALdllImageLine calling - pfnPointFunc - calling gvBurnPoint
>
> Questions: 2.  gdalrasterize generate transparent png of the raster
>
> i know the png driver doesn't support create but create copy.
>
> How about the buffer written to MEM driver and then to PNG driver. But I
> want it to transparent and not black ?
>
> Thanks for your previous replies.
>
> Gane
>
>
>
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev



-- 
Kyle


More information about the gdal-dev mailing list