[gdal-dev] gdal_rasterize failing when trying multiband
Even Rouault
even.rouault at spatialys.com
Thu Jun 7 04:05:03 PDT 2018
Mario,
I suggest you use gdal_rasterize to produce as many GeoTIFF files as you have
'burning sessions'
And then use gdal_merge.py -separate to make a single GeoTIFF from all the
above ones.
Even
> Hello,
>
> I was doing some point rasterization of vector data from postgis database by
> using gdal_rasterize from a bash script, the command looks like this:
>
>
> gdal_rasterize -a value -b $COUNT -tr $RESOLUTION -te $BBOX -a_nodata
> $NODATA -a_srs $EPSG PG:'host=localhost dbname=databio user=postgres
> password=postgres' -sql "SELECT ST_Centroid(g.geom), AVG($COLUMN) as value
> FROM $GRID g, $OBSERVACION o WHERE utc_date='$DATE' AND
> vessel_cfr='$VESSEL' AND ST_Intersects(o.geom,g.geom) IS TRUE GROUP BY
> g.gid" ./bands/$DATE2"_"$COLUMN".tif"
>
>
> The problem is that I want to generate a geotif file with multiple bands, so
> if I remove the -b $COUNT parameter and value it works and I get a .tif
> file with the -a value printed on it for band1, but the idea is to reuse
> that command in a for loop to add further bands and I am gettin this error:
>
>
> -b option cannot be used when creating a GDAL dataset.
>
> I tried to run the comand once to create the tif file without the -b option
> and then run it additional times with the -b option when the tif is already
> created but it makes no difference.
>
>
> I am stucked with this and I am starting to think that -b option can only be
> used with -burn parmeter and as far as I know -burn is only for constant
> values...
>
>
> thank you in advance for any help.
>
> cheers,
>
> Mario
>
>
> This e-mail and the documents attached are confidential and intended solely
> for the addressee; it may also be privileged. If you receive this e-mail in
> error, please notify the sender immediately and destroy it. As its
> integrity cannot be secured on the Internet, the Atos group liability
> cannot be triggered for the message content. Although the sender endeavors
> to maintain a computer virus-free network, the sender does not warrant that
> this transmission is virus-free and will not be liable for any damages
> resulting from any virus transmitted.
>
> Este mensaje y los ficheros adjuntos pueden contener información
> confidencial destinada solamente a la(s) persona(s) mencionadas
> anteriormente y pueden estar protegidos por secreto profesional. Si usted
> recibe este correo electrónico por error, gracias por informar
> inmediatamente al remitente y destruir el mensaje. Al no estar asegurada la
> integridad de este mensaje sobre la red, Atos no se hace responsable por su
> contenido. Su contenido no constituye ningún compromiso para el grupo Atos,
> salvo ratificación escrita por ambas partes. Aunque se esfuerza al máximo
> por mantener su red libre de virus, el emisor no puede garantizar nada al
> respecto y no será responsable de cualesquiera daños que puedan resultar de
> una transmisión de virus.
--
Spatialys - Geospatial professional services
http://www.spatialys.com
More information about the gdal-dev
mailing list