[postgis-users] Spoke too soon

Andy Colson andy at squeakycode.net
Sun Feb 5 07:29:32 PST 2012


On 02/05/2012 09:13 AM, Darrel Maddy wrote:
> I would be grateful if someone could help me with the syntax for filenames when using the WHERE clause in gdal_translate
>
> I have
> gdal_translate -of GTiff "PG:host=localhost port=5432  dbname=testcuda user=postgres password=H$%£"! schema=public table=rast100 where='filename="Heights_11_10.tif"' mode=2" Height10.tif
>
> I tried various forms of the 'filename=' clause (and simplifying the filename to H10.tif) but without success (the form given on the FAQ does not work in windows either). What does work is:
>
> gdal_translate -of GTiff "PG:host=localhost port=5432  dbname=testcuda user=postgres password= H$%£"!  schema=public table=rast100 where='rid>someno AND rid<someno' mode=2" Height10.tif
>
> Obviously I can work with the latter but it requires me to know the start and end rid (or do a query to find it). Ideally I  would like to be able to just download the image via the filename.
>
> Thanks in anticipation of your help.
>
> Darrel
>
>
>

sql uses single quote for a string, and double quote for column names.

where='filename="Heights_11_10.tif"'

that probably meant: if column filename matched column Heights_11_10.tif.

Try switching the quotes:

where="filename='Heights_11_10.tif' "

-Andy



More information about the postgis-users mailing list