Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

Is there a way to convert a line layer (shp or PostGIS) data into (x, y , z, cost) i.e. (From_node, To_node, optional_Elevation, Cost/Weight) ?

share|improve this question

1 Answer 1

up vote 3 down vote accepted

Some additional information would be useful to find out exactly how your data looks like and what you are trying to get out of it. The following statement might be a start:

SELECT startpoint(the_geom), endpoint(the_geom), z(endpoint(the_geom)), 
length(the_geom) FROM test_lines;

I didn't know where you want the elevation to be measured, so I took the z value at the end point for now.

Update Jul 31:

SELECT startpoint(the_geom), endpoint(the_geom), elevation, cost 
FROM test_lines;

Update Aug 1:

In OGR, a LineString object has similar functions StartPoint() and EndPoint().

share|improve this answer
    
the elevation and cost/weight are just stored in fields –  dassouki Jul 31 '10 at 11:55
    
startpoints and endpoints are the segment ends –  dassouki Jul 31 '10 at 11:56
    
are you assuming that startpoint and endpoints are separate fields? –  dassouki Jul 31 '10 at 13:58
1  
startpoint() and endpoint() are both functions that accept lines as an input. –  underdark Jul 31 '10 at 14:03
1  
in OGR, a LineString object gdal.org/ogr/classOGRLineString.html has similar functions StartPoint() and EndPoint() –  underdark Jul 31 '10 at 14:32

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.