[gdal-dev] gdal_rasterize failing when trying multiband

Nunez, Mario mario.nunez at atos.net
Thu Jun 14 03:53:21 PDT 2018


Anybody knows if this is possible?

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"

I mean using -b parameter to directly create a geotiff with different bands from a postgis database query.

I would like to avoid doing single rasterizations and then a merge.
Thank you in advance.


From: Nunez, Mario
Sent: Thursday, June 07, 2018 1:32 PM
To: Even Rouault <even.rouault at spatialys.com>; gdal-dev at lists.osgeo.org
Subject: Re: [gdal-dev] gdal_rasterize failing when trying multiband


Thank you for your help,

I know that is a possibility but this is to process big amounts of data and I would like to avoid the merge processing time if possible by rasterizing over the same tif...



I would like to know if it is possible...



cheers,

Mario

________________________________
De: Even Rouault <even.rouault at spatialys.com<mailto:even.rouault at spatialys.com>>
Enviado: jueves, 7 de junio de 2018 13:05:03
Para: gdal-dev at lists.osgeo.org<mailto:gdal-dev at lists.osgeo.org>
Cc: Nunez, Mario
Asunto: Re: [gdal-dev] gdal_rasterize failing when trying multiband

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
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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20180614/7379e84b/attachment-0001.html>


More information about the gdal-dev mailing list