Good point and apologies I haven't been more clear.<div><br></div><div>We want to achieve this: <a href="http://npm.landcareresearch.co.nz/elevation/">http://npm.landcareresearch.co.nz/elevation/</a></div><div>with Open Source technology and our own data. Also, instead of doing a single line, we want to implement a LineString which can have multiple control points in it.</div>
<div><br></div><div>So far we've got it working by querying for each point on the line, say n segments would give us n+1 points on the line and therefore n+1 queries which could potentially be a lot. At the moment one query is run for each point on the line, which is fine, but I believe there must be a much better way with PostGIS to get all the points' st_values at once, preferably, like in the example above, also the distance of each point from the first point on the line.</div>
<div><br></div><div>Thought an example application, similar to the one we are developing would be better than a thousand words.</div><div><br></div><div>Thanks for all your help.</div><div><br>Regards,</div><div>Tim</div>
<div class="gmail_extra"><br clear="all"><div>Tim-Hinnerk Heuer<br><br>Twitter: @geekdenz<br><div>Blog: <a href="http://www.thheuer.com/" target="_blank">http://www.thheuer.com</a></div></div><br>
<br><br><div class="gmail_quote">On 15 December 2012 13:18, Pierre Racine <span dir="ltr"><<a href="mailto:Pierre.Racine@sbf.ulaval.ca" target="_blank">Pierre.Racine@sbf.ulaval.ca</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Maybe it would be better to describe more generally what you are trying to achieve. Most complex processing can normally be achieved in one complex query.<br>
<br>
PostgreSQL should cache what was loaded in previous queries so that it does not necessarily reload tiles at each query.<br>
<br>
Pierre<br>
<div class="im"><br>
> We query the points on the line with one query for each point. This could be<br>
> optimised like this:<br>
> SELECT ST_AsText(<br>
> ST_line_interpolate_point(<br>
> ST_GeometryFromText('LINESTRING(0 0,0 1,1 1)'), CAST(p AS numeric)/10<br>
> )<br>
> )<br>
> FROM generate_series(1,10) p;<br>
> to get all points. But this is still requiring one query for each point on the line. I<br>
> suspect, if we were to query all points at once, there will have to be less reading<br>
> of the raster, because the points are likely to be on the same tile. However, I do<br>
> not know how to achieve that. Can I somehow intersect the line with the raster<br>
> and query all the points above?<br>
><br>
> Any hints would be greatly appreciated.<br>
><br>
> Thanks,<br>
> Tim<br>
><br>
> Tim-Hinnerk Heuer<br>
><br>
> Twitter: @geekdenz<br>
><br>
</div>> Blog: <a href="http://www.thheuer.com" target="_blank">http://www.thheuer.com</a> <<a href="http://www.thheuer.com/" target="_blank">http://www.thheuer.com/</a>><br>
<div class="im">><br>
><br>
><br>
> On 9 December 2012 20:36, Tim-Hinnerk Heuer <<a href="mailto:th.heuer@gmail.com">th.heuer@gmail.com</a>> wrote:<br>
><br>
><br>
>       Hi Pierre,<br>
><br>
>       Great! Thank you so much, that worked!<br>
><br>
>       You're a genius!<br>
><br>
>       In case you are wondering. That point is Mount Ruhapehu and it gave<br>
> me the answer: 2611.7314453125 (m) which is indeed correct.<br>
><br>
>       Kind regards,<br>
>       Tim<br>
><br>
>       Tim-Hinnerk Heuer<br>
><br>
>       Twitter: @geekdenz<br>
><br>
</div>>       Blog: <a href="http://www.thheuer.com" target="_blank">http://www.thheuer.com</a> <<a href="http://www.thheuer.com/" target="_blank">http://www.thheuer.com/</a>><br>
<div class="im HOEnZb">><br>
><br>
><br>
>       On 9 December 2012 20:24, Pierre Racine<br>
> <<a href="mailto:Pierre.Racine@sbf.ulaval.ca">Pierre.Racine@sbf.ulaval.ca</a>> wrote:<br>
><br>
><br>
>               SELECT ST_Value(rast,ST_SetSRID(ST_Point(1821416, 5649720),<br>
> 2193))<br>
>               FROM nzdem3<br>
>               WHERE  ST_Intersects(rast,ST_SetSRID(ST_Point(1821416,<br>
> 5649720), 2193))<br>
><br>
><br>
<br>
</div><div class="HOEnZb"><div class="h5">_______________________________________________<br>
postgis-users mailing list<br>
<a href="mailto:postgis-users@lists.osgeo.org">postgis-users@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users" target="_blank">http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users</a><br>
</div></div></blockquote></div><br></div>