[postgis-users] [Raster] MNT 250 IGNF data import problem
Yves Jacolin
yves.jacolin at camptocamp.com
Tue Oct 22 08:44:39 PDT 2013
Hugues, Pierre,
Le mardi 22 octobre 2013 14:20:28 Hugues François a écrit :
> Hello,
>
> I'm sorry but I don't understand why you are looking for numerous band with
> a mnt. In my mind it has only one single band made of elevation values.
Because I did a quick test and copied past previous SQL requests and I did not
clean it before! Of course you can remove the next 2 bands which don't exist
but the first one should have correct statistic.
Thanks Pierre to let me know the logical ;)
> Rasters are not so easy to display correctly with qgis or another desktop
> software.
I already see raster data in QGIS and if there is some issue, I will be
pleased to understand them!
As far as I understand, gdal is wrong somewhere. I get this message in QGIS
log:
Warning: RasterIO error: Error retrieving raster data from database
which come from gdal source code (postgresql provider).
Looking in the pgsql log I get a lot of wrong request:
SQL function "st_polygonfromtext" statement 1
2013-10-22 17:38:47 CEST STATEMENT: SELECT st_band(rast, 1), st_width(rast),
st_height(rast), st_bandpixeltype(rast, 1), st_bandnodatavalue(rast, 1),
st_scalex(rast), st_scaley(rast), st_upperleftx(rast), st_upperlefty(rast)
FROM raster.mnt250 WHERE st_intersects(rast,
st_polygonfromtext('POLYGON((89875,00000000000000000
7120125,00000000000000000, 4789875,00000000000000000
7120125,00000000000000000, 4789875,00000000000000000
2720125,00000000000000000, 89875,00000000000000000 2720125,00000000000000000,
89875,00000000000000000 7120125,00000000000000000))', 2154))
As you can see POLYGON is made of wrong WKT: number is using the comma as the
decimal separator which is wrong in WKT (should be .)
> On my part, when i want to make tests with or without walues, I
> prefer to use st_dumpaspolygons or st_envelope. You may find some
> information on this, maybe a bit dated now, page :
> http://trac.osgeo.org/postgis/wiki/WKTRaster (scroll down to Displaying
> postgis rasters).
Indeed and QGIS is listed ;) but unfortunately raster plugin is for QGIS 1.x.
I tried the SQL resquest with st_dumpaspolygons but except a list of "NOTICE
Ring Self-intersection at or near point [..] [..]" nothing interesting ;)
Thanks both for your reply,
Y.
>
> Hugues.
>
>
>
>
> -----Original Message-----
> From: postgis-users-bounces at lists.osgeo.org
> [mailto:postgis-users-bounces at lists.osgeo.org] On Behalf Of Yves Jacolin
> Sent: Tuesday, October 22, 2013 1:48 PM
> To: PostGIS Users Discussion
> Subject: [postgis-users] [Raster] MNT 250 IGNF data import problem
>
> Hello list,
>
> I am currently trying importing french IGN MNT 250 into a postgis database
> (v 2.0.1):
>
> raster2pgsql -b 1 -s 2154 -I -C -t 100x100 MNT250_L93_FRANCE.ASC
> raster.mnt250
> | psql -d formation
>
> When testing my raster layer I get strange result:
> SELECT rid, band, (stats).*
> FROM (SELECT rid, band, ST_SummaryStats(rast, band) As stats
> FROM raster.mnt250 CROSS JOIN generate_series(1,3) As band
> WHERE rid=2) As foo;
>
> NOTICE: Invalid band index (must use 1-based). Returning NULL
> CONTEXT: SQL function "st_summarystats" statement 1 [several time] rid |
> band | count | sum | mean | stddev | min | max
> -----+------+-------+-----+------+--------+-----+-----
> 2 | 1 | 10000 | 0 | 0 | 0 | 0 | 0
> 2 | 2 | | | | | |
> 2 | 3 | | | | | |
>
> QGIS can't display my layer (well the layer seems white) and if I request my
> layer I get some weird value (224964728 for example).
>
> In QGIS log, I have:
>
> ERROR 1: PG: dbname=formation host=localhost user=yjacolin password=
> port=5432 mode=2 schema=raster table=mnt250, band 1: IReadBlock failed at X
> offset 32, Y offset 29 ERROR 1: Error retrieving raster data from database
>
> Any idea why this is not working as expected?
>
> When I use raster2pgsql I get this message:
> raster2pgsql: /usr/local/lib/libgdal.so.1: no version information available
> (required by raster2pgsql)
>
> I built gdal but not postgis.
>
> Thanks,
>
> Y.
> --
> Responsable Formation et Support
> Camptocamp France SAS
> Savoie Technolac, BP 352
> 73377 Le Bourget du Lac, Cedex
> Tel (France) : +33 4 79 26 57 98
> Tel (Suisse) : 021 619 10 43 (new)
> Mob. : +33 6 18 75 42 21
> Fax : 04 79 70 15 81
> Mail : yves.jacolin at camptocamp.com
> http://www.camptocamp.com
>
> _______________________________________________
> postgis-users mailing list
> postgis-users at lists.osgeo.org
> http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users
> _______________________________________________
> postgis-users mailing list
> postgis-users at lists.osgeo.org
> http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users
--
Responsable Formation et Support
Camptocamp France SAS
Savoie Technolac, BP 352
73377 Le Bourget du Lac, Cedex
Tel (France) : +33 4 79 26 57 98
Tel (Suisse) : 021 619 10 43 (new)
Mob. : +33 6 18 75 42 21
Fax : 04 79 70 15 81
Mail : yves.jacolin at camptocamp.com
http://www.camptocamp.com
More information about the postgis-users
mailing list