[Qgis-user] Trying to get the wktraster plugin to work

Andreas Neumann a.neumann at carto.net
Thu Dec 2 00:29:53 PST 2010


Hi Jorge and Mauricio,

Thank you for both of your help/feedback.

As far as I can tell, there are two problems with the QGIS wktraster
plugin. It is currently not generating the correct connection string.
Mauricio - could you please check?

1. schema name is not picked up correctly from the table

2. reading mode is not correctly specified. My data set is tiled (read in
with the "k" parameter). I select "Read tiled raster in a table" and the
plugin selects mode "1" - but it should select mode "2", according to
Jorge and http://trac.osgeo.org/gdal/wiki/frmts_wtkraster.html.

It seems like Mauricios plugin uses a zero-based list for the mode, while
it should use a one-based list.

The second problem is very easy to fix by changing the line

mode=self.dlg.ui.comboBox_2.currentIndex()
to
mode=self.dlg.ui.comboBox_2.currentIndex()+1

and then
if (mode!=2):
to
if (mode!=3):

The first problem is little harder to fix.

Anyway - once I fixed the issue, the raster loads fine, but it is very,
very, very slow - too slow for real work.

I have to admit, I did not create pyramids. Would the wktraster plugin and
the underlying driver support the pyramids? My test raster file is
3600x4000 pixels - so it isn't really large.

Any experiences with the pyramids with wktraster?

Thanks a lot so far!

Andreas

On Wed, December 1, 2010 10:25 pm, Jorge Arévalo wrote:
> 2010/12/1 Maurício de Paulo <mauricio.dev at gmail.com>:
>> Thanks jorge!
>> Then I figure it's a bug in the plugin. I wrote the wrong modes. I'm
>> fixing
>> and updating.
>> Hum... I'm going to wait for your responde on the parsing part. If not,
>> should I parse it on the plugin?
>> Best regards,
>> Mauricio de Paulo
>>
>
> Hi Mauricio,
>
> Just check it. If you don't provide schema name, 'public' is
> automatically selected. So, if you specify 'dtm.dtmav' as table name,
> and don't provide a 'schema' option, the driver tries to connect with
> 'public.dtm.dtmav', what is wrong.
>
> I suppose I could allow the "table=schema.table_name" syntax, but I'd
> like to keep the 'schema=' keyword to keep the schema browsing
> capability.
>
> So, it's not a plugin error. I don't think you need to change it. By
> now, just use the 'schema' keyword to specify a schema name. About the
> mode, remember that:
>
> - 'mode=1' means each row is a different raster. Report all rows as
> subdatasets
> - 'mode=2' means all rows are tiles of a bigger raster. The driver
> will 'construct' a whole raster coverage based on all tiles' extent
>
> The default mode is 'mode=1'. If you stored a tiled raster (providing
> -k option to gdal2wkraster/raster2pgsql script) and you want the
> entire raster again, provide 'mode=2' in connection string. Otherwise,
> each row will be treated as a single raster file.
>
> About PostgreSQL 9.0, I didn't test it yet, but AFAIK, it should work
> in the same way that works with PostgreSQL 8.4, for example.
>
> I'm really interested in this work. Thanks for testing the driver :-)
>
>> 2010/12/1 Jorge Arévalo <jorge.arevalo at deimos-space.com>
>>>
>>> Hello,
>>>
>>> On Wed, Dec 1, 2010 at 7:19 PM, Maurício de Paulo
>>> <mauricio.dev at gmail.com> wrote:
>>> > Hi Andreas,
>>> > As you were able to load the raster metadata i'm assuming you
>>> installed
>>> > the
>>> > wktraster sql on the database.
>>> > I've never tested myself on postgresql 9.0.
>>> > Do you have a postgresql 8.4 instance to test too? Just to be sure if
>>> > it's a
>>> > gdal incompatibility with 9.0.
>>> > Thanks for the information, I'm repassing to Jorge (GDAL's
>>> developper).
>>> > Best regards,
>>> > Mauricio de Paulo
>>> >
>>> >> Hi,
>>> >>
>>> >> I am trying to get the wktraster plugin to work.
>>> >>
>>> >> The initial connection to the db is fine. It lists all my raster
>>> >> datasets
>>> >> I have in the db.
>>> >>
>>> >> After selecting a raster (and adding the schema-name in front of the
>>> >> table-name) I hit ok and after entering the password again, I get
>>> the
>>> >> following error message:
>>> >>
>>> >> Could not load PG: dbname=uster host=localhost user=an password=xxx
>>> >> port=5432 table=dtm.dtmav mode=1
>>> >>
>>> >> In the console that started QGIS I get a warning:
>>> >>
>>> >> Warning: This version of PostgreSQL is not supported and may not
>>> work.
>>> >> ERROR 1: Error browsing database for PostGIS Raster properties
>>> >>
>>> >> Here is my Postgres/Postgis version string:
>>> >>
>>> >> "PostgreSQL 9.0.1 on x86_64-unknown-linux-gnu, compiled by GCC gcc
>>> >> (Ubuntu
>>> >> 4.4.3-4ubuntu5) 4.4.3, 64-bit"
>>> >>
>>> >> "POSTGIS="1.5.2" GEOS="3.2.0-CAPI-1.6.0" PROJ="Rel. 4.7.1, 23
>>> September
>>> >> 2009" LIBXML="2.7.6" USE_STATS"
>>> >>
>>> >> Do you have any idea what may be wrong here? Is PostgreSQL 9.0 not
>>> >> supported? It works fine with my other QGIS projects ...
>>> >>
>>> >> Thanks,
>>> >> Andreas
>>> >>
>>> >> --
>>> >> Andreas Neumann
>>> >> http://www.carto.net/neumann/
>>> >> http://www.svgopen.org/
>>> >>
>>> >
>>> >
>>> > --
>>> > Mauricio de Paulo
>>> > Engenheiro Cartografo
>>> >
>>> >
>>>
>>> I assume you're using the new version of GDAL driver, commited on
>>> release 20912 (http://trac.osgeo.org/gdal/changeset/20912). The right
>>> syntax for the connection string should be
>>>
>>> PG:"dbname=uster host=localhost user=an password=xxx port=5432
>>> schema=dtm table=dtmav mode=1"
>>>
>>> instead of
>>>
>>> PG: dbname=uster host=localhost user=an password=xxx port=5432
>>> table=dtm.dtmav mode=1
>>>
>>> With this string, you'll read the rows of the table dtmav, schema dtm,
>>> as different raster files. So, the driver will report these rows as
>>> subdatasets. If you use mode=2, all the rows are considered as tiles
>>> of a bigger raster coverage.
>>>
>>> Anyway, let me check if the driver parses the
>>> "table=<schema>.<table_name>" syntax. I can't remember it.
>>>
>>> --
>>> Jorge Arévalo
>>> Internet & Mobilty Division, DEIMOS
>>> jorge.arevalo at deimos-space.com
>>> http://mobility.grupodeimos.com/
>>> http://gis4free.wordpress.com
>>
>>
>>
>> --
>> Mauricio de Paulo
>> Engenheiro Cartografo
>>
>>
>
>
>
> --
> Jorge Arévalo
> Internet & Mobilty Division, DEIMOS
> jorge.arevalo at deimos-space.com
> http://mobility.grupodeimos.com/
> http://gis4free.wordpress.com
>


-- 
Andreas Neumann
http://www.carto.net/neumann/
http://www.svgopen.org/




More information about the Qgis-user mailing list