[postgis-users] PostGIS - Simple Raster Point Query

Tim-Hinnerk Heuer th.heuer at gmail.com
Fri Dec 14 14:15:50 PST 2012


Cool, so we got the query working and what we wanted is achieved with our
little service. However, what we are doing is probably far from optimal:

We query the points on the line with one query for each point. This could
be optimised like this:
SELECT ST_AsText(
ST_line_interpolate_point(
ST_GeometryFromText('LINESTRING(0 0,0 1,1 1)'), CAST(p AS numeric)/10
)
)
FROM generate_series(1,10) p;
to get all points. But this is still requiring one query for each point on
the line. I suspect, if we were to query all points at once, there will
have to be less reading of the raster, because the points are likely to be
on the same tile. However, I do not know how to achieve that. Can I somehow
intersect the line with the raster and query all the points above?

Any hints would be greatly appreciated.

Thanks,
Tim

Tim-Hinnerk Heuer

Twitter: @geekdenz
Blog: http://www.thheuer.com



On 9 December 2012 20:36, Tim-Hinnerk Heuer <th.heuer at gmail.com> wrote:

> Hi Pierre,
>
> Great! Thank you so much, that worked!
>
> You're a genius!
>
> In case you are wondering. That point is Mount Ruhapehu and it gave me the
> answer: 2611.7314453125 (m) which is indeed correct.
>
> Kind regards,
> Tim
>
> Tim-Hinnerk Heuer
>
> Twitter: @geekdenz
> Blog: http://www.thheuer.com
>
>
>
> On 9 December 2012 20:24, Pierre Racine <Pierre.Racine at sbf.ulaval.ca>wrote:
>
>> SELECT ST_Value(rast,ST_SetSRID(ST_Point(1821416, 5649720), 2193))
>> FROM nzdem3
>> WHERE  ST_Intersects(rast,ST_SetSRID(ST_Point(1821416, 5649720), 2193))
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20121215/7cce3e29/attachment.html>


More information about the postgis-users mailing list