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

Jorge Arévalo jorge.arevalo at deimos-space.com
Fri Dec 3 01:43:47 PST 2010


On Fri, Dec 3, 2010 at 12:05 AM, Maurício de Paulo
<mauricio.dev at gmail.com> wrote:
> Well, version 0.2.2, now with a schema-friendly loader and I turned off the
> mode combobox.
> Unfortunately, on gdal 1.7 I couldn't get the mode to work. Was anyone
> successful?
> Best regards,
> Mauricio de Paulo
>

Hi,

The "mode" only works in new version of the driver. Not with GDAL 1.7.

You said the plugin was in contrib directory, in the SVN, don't you?

Best regards,

-- 
Jorge Arévalo
Internet & Mobilty Division, DEIMOS
jorge.arevalo at deimos-space.com
http://mobility.grupodeimos.com/
http://gis4free.wordpress.com
>
> 2010/12/2 Maurício de Paulo <mauricio.dev at gmail.com>
>>
>> Ok, now that i got my hands on my ubuntugis packages... Well some odd
>> stuff.
>> Hum... the "mode=" was added on the new driver? On 1.7 I couldn't make it
>> work with it.
>> I fixed andreas' sugestions and found a new bug. When I read from the
>> table I should read both schema and tablename from that. And at the moment
>> the plugin is not doing it. This could solve the "schema" problem. I'm going
>> to fix this and release a new version.
>> I don't really know if I'm going to let the mode turned on. Only if I can
>> get it to work with ubuntugis' gdal version.
>> Mauricio de Paulo
>>>
>>>
>>> On Thu, Dec 2, 2010 at 9:00 AM, Jorge Arévalo
>>> <jorge.arevalo at deimos-space.com> wrote:
>>>>
>>>> On Thu, Dec 2, 2010 at 9:29 AM, Andreas Neumann <a.neumann at carto.net>
>>>> wrote:
>>>> > 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
>>>> >
>>>>
>>>> Hi Andreas, Mauricio
>>>>
>>>> Yes, it's possible to create pyramids with the PostGIS Raster loader,
>>>> using the "-l" and "-V" options as follows:
>>>>
>>>> - "-l N", where N is the overview level. This option force GDAL to
>>>> build overviews of the original raster, and store them as new raster
>>>> tables with the name "o_<LEVEL>_<RASTER_TABLE>". <RASTER_TABLE> is the
>>>> name you provide with the "-t" option. You should execute the loader
>>>> one time for each pyramid level desired (-l 2, -l 4, -l 8, and so on).
>>>>
>>>> - "-V" forces the creation of the RASTER_OVERVIEWS table. This table
>>>> stores the names of all the overviews of all the raster tables (the
>>>> overviews are different tables, remember it). You should only provide
>>>> this option the first time you execute the loader script. But provide
>>>> it at least one time, because the GDAL driver needs this table to know
>>>> if each raster table has overviews or not.
>>>>
>>>> Further information on raster loader here:
>>>> http://trac.osgeo.org/postgis/wiki/WKTRaster/SpecificationFinal01
>>>>
>>>> You probably may want to test the plugin with raster overviews. I'm
>>>> going to test it ASAP. Anyway, the driver performance is an important
>>>> TODO task.
>>>>
>>>>
>>>> --
>>>> Jorge Arévalo
>>>> Internet & Mobilty Division, DEIMOS
>>>> jorge.arevalo at deimos-space.com
>>>> http://mobility.grupodeimos.com/
>>>> http://gis4free.wordpress.com
>>>>
>>>> > 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/
>>>> >
>>>> >
>>>
>>>
>>>
>>> --
>>> Mauricio de Paulo
>>> Engenheiro Cartografo
>>>
>>
>>
>>
>> --
>> Mauricio de Paulo
>> Engenheiro Cartografo
>>
>
>
>
> --
> Mauricio de Paulo
> Engenheiro Cartografo
>
>



More information about the postgis-users mailing list