[postgis-users] Elevation Profiles

ANDREW WOOLEY AWOOLEY at mountainland.org
Wed Nov 24 10:46:31 PST 2004


Folks,

I have been working on this idea for some time and have been trying to
implement elevation profiles and have yet to get it working like I want.
 I am hoping that someone has some good ideas for me.

Here is my problem. I have a series of lines in a table.  I also have a
table with elevations as polygons. I overlay them using this query:
select e.gridcode as elevation from mtntrails_elevation as e, route as
r where e.the_geom && r.the_geom; 
(route has one trail with 3 or 4 segments.)(mtntrails_elevation has ~7
million rows.)

This query works. It pulls out elevations where they overlap the trail.
 However, when I list out the elevations, they don't seem to be in the
"correct" order - that is the order I think they should be in.  The way
that I hope/imagine this happens is that it will select based on
coordinates of the vertices in the line. However, it seems that they are
selected all at once in no particular order. By order I mean I want the
polygons in the elevation table to be selected in spatial order from the
start of the trail to the end of the trail.

Is there a better way to go about this?  I have tried to collect() the
trail segments, but that doesn't seem to help. Is there something wrong
with my basic premise?  I have thought about breaking up the line into
vertices and looping through each one and selecting that way, but that
seems unnecessarily difficult.  

Any ideas?

Thanks.

Andrew Wooley
GIS Coordinator
Mountainland Association of Governments
586 E 800 N
Orem, UT 84097
ph: 801.229.3844
email: awooley at mountainland.org
web: http://maps.mountainland.org



More information about the postgis-users mailing list