I'm trying to convert a multipolygon vector layer to a raster using the GDAL tool gdal_rasterize
. The command I am using is:
gdal_rasterize -b 1 -burn -9999 PG:"dbname=db password=password" \
auckland auckland.png
However, it seems my specification of the source for the postgis layer is incorrect as I get an
ERROR 4: 'auckland.png' does not exist in the file system,
and is not recognised as a supported dataset name.`
So how do I successfully connect to postgres and export a vector as a tif? Is it possible?
Numerous other attempts have included:
gdal_rasterize -b 1 -i -burn -9999 PG:"dbname=db password=" -l \
auckland auckland.png
gdal_rasterize -b 1 -i -burn -9999 -l auckland PG:"dbname=db \
password=password" auckland.png
And this one from Roger's Rants:
gdal_rasterize -b 1 -i -burn -9999 PG:'host=localhost dbname='unep'' \
-sql "SELECT ST_buffer(the_geom, .12) from coastlines where name='Poland'" \
Poland_elev.tif
When I use ogr2ogr
to export the layer out of postgres as a shapefile, and then gdal_rasterize
to convert to a .tif
file it all works smoothly.
Using GDAL 1.11.2 version on Ubuntu 15.10.
Still no love with either:
gdal_rasterize -b 1 -burn -9999 PG:"dbname=db password=pwd" \
-l auckland auckland.tif
or:
gdal_rasterize -b 1 -burn -9999 -l auckland PG:"dbname=db \
password=pwd" auckland.tif
The GDAL supported output file. Must support update mode access
. – user30184 Mar 30 '16 at 9:30gdal_rasterize -i -burn -9999 PG:"dbname='my_db' host='localhost' port='5432' user='my_user' password='my_password'" -l states -a_srs epsg:4326 -tr 0.1 0.1 output.tif
Output.tif did not exist which lead to an error with -b 1 which you used so I left it out. – user30184 Mar 30 '16 at 21:18