[postgis-users] Spoke too soon
Darrel Maddy
darrel.maddy at newcastle.ac.uk
Sun Feb 5 09:09:23 PST 2012
Thanks for the advice on the workaround. It is good to know that I was not doing anything fundamentally wrong. If necessary I will see if making a numeric field with a number for each image, which can be used instead of the filename text, helps.
D
-----Original Message-----
From: postgis-users-bounces at postgis.refractions.net [mailto:postgis-users-bounces at postgis.refractions.net] On Behalf Of Paragon Corporation
Sent: 05 February 2012 16:39
To: 'PostGIS Users Discussion'
Cc: 'David Zwarg'
Subject: Re: [postgis-users] Spoke too soon
Darrell,
I'm having similar issues using our alpha3 build and latest comiled from http://vbkto.dyndns.org/sdk/ . There is an example in the FAQ with a text field and that used to work when I tried it when I wrote that FAQ item a while ago on windows.
I think it might be because of some changes in GDAL driver or raster that broke string quoting. I was hoping this was fixed already. I've cc'd Jorge since he manages the raster driver.
I think David Zwarg was planning to work on this at the code sprint which should be starting soon.
Here is what I used to use which worked a while back:
gdal_translate -of PNG "PG:host=localhost port=5441 dbname=postgis20_sampler user=postgres password='whatever' schema='aerials' table=test_100_100 mode='2' where="filename='23128870.jpg'"" C:\23128870.png
and now I get a:
ERROR 1: Error browsing database for PostGIS Raster properties GDALOpen failed - 1 Error browsing database for PostGIS Raster properties
I haven't checked my logs to see what query its running. could be one of the field changes in the view.
As a work around, try this:
First figure out the rid range of the file with an SQL Query like:
SELECT max(rid), min(rid) FROM aerials.test_100_100 WHERE filename='23128870.jpg';
gdal_translate -of PNG "PG:host=localhost port=5441 dbname=postgis20_sampler user=postgres password='whatever' schema='aerials'
table=test_100_100 mode='2' where='rid between 1 and 2500'" C:\23128870.png
> -----Original Message-----
> From: postgis-users-bounces at postgis.refractions.net
> [mailto:postgis-users-bounces at postgis.refractions.net] On Behalf Of
> Andy Colson
> Sent: Sunday, February 05, 2012 10:30 AM
> To: PostGIS Users Discussion
> Subject: Re: [postgis-users] Spoke too soon
>
> 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
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
>
_______________________________________________
postgis-users mailing list
postgis-users at postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users
More information about the postgis-users
mailing list