[postgis-users] Raster2pgsql - preserving number of decimal places

Nick Ward Nick.Ward at landmark.co.uk
Fri Sep 23 04:54:49 PDT 2016


Hello,

I'm investigating loading some height data into Postgis as type Raster.
It comes in .asc files and I am using raster2pgsql and psql to load it.

I'm running with PostgreSQL 9.5.2 and POSTGIS="2.2.2 r14797".

I've tried the following raster2pgsql combinations:
raster2pgsql -s 27700 -I -C -M *.asc -F public.test1 > test1.sql
raster2pgsql -I -C -M *.asc -F public. test2 > test2.sql
raster2pgsql -I -M *.asc -F public.test3 > test3.sql

After loading with psql I am querying it with this sql:

SELECT filename, rid, ST_Value(rast, pt.geom) As val
FROM test3 CROSS JOIN (SELECT st_GeomFromText('POINT(454900 254900)', 0) As geom) As pt
WHERE rid in (221,222,223,224);

My problem is that instead of values with 2 decimal places I get 12.
So this query should bring back 145.44 but I get 145.440002441406.

Please could you let me know if there is anything I can do to preserve the correct number of DPs?
Any help and advice would greatly appreciated.

Regards
Nick


Registered Office: 7 Abbey Court, Eagle Way, Sowton, Exeter, Devon, EX2 7HY. Registered Number 2892803 Registered in England and Wales. The information contained in this e-mail is confidential and may be subject to legal privilege. If you are not the intended recipient, you must not use, copy, distribute or disclose the e-mail or any part of its contents or take any action in reliance on it. If you have received this e-mail in error, please e-mail the sender by replying to this message. All reasonable precautions have been taken to ensure no viruses are present in this e-mail. Landmark Information Group Limited cannot accept responsibility for loss or damage arising from the use of this e-mail or attachments and recommend that you subject these to your virus checking procedures prior to use.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20160923/39001525/attachment.html>


More information about the postgis-users mailing list