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.

SELECT sum(st_length(st_intersection(POLY.geom, LINE.geom))) AS sum_line_length... Is this function OK to calculate the sum of lines length? Wonder if it do the clip line where one line go from one polgon to another or it just sum the line length to polygon from witch the line started? Thanks for answer. Best regards.

share|improve this question
    
Are you looking for a PostGIS solution? –  underdark Feb 19 '13 at 15:06
add comment

closed as not a real question by underdark Mar 21 '13 at 12:55

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.

1 Answer

? if Postgis tag missing?

geometry ST_Intersection( geometry geomA , geometry geomB ); Description Returns a geometry that represents the point set intersection of the Geometries.

boolean ST_Intersects(geom, geom)

SELECT sum(st_length(LINE.geom))) AS sum_line_length 
from LINE as LINE , poly as poly 
WHERE poly.id =1 AND ST_Intersects(poly.geom, LINE.geom)

That would return sum of all lines which intersect polygon in poly table with id 1

If you want to clip line with polygon and get sum of those lines code would be something like yours. im not sure if st_intersections returns line or point collection containing intersection points

share|improve this answer
    
Yep - not shure too. :-) My Query in Manifold looks like: SELECT [POLYGON].[KO], Round(Sum (Length(ClipIntersect([Water_pipe Table].[ID], [POLYGON].[ID]), "m")),1) AS Length_in_M FROM [Water_pipe Table] INNER JOIN [POLYGON] ON Touches([POLYGON].[ID], [Water_pipe Table].[ID]) Group by [POLYGON].[KO] - it works OK. Now try to test in QGis. –  Andrej Feb 19 '13 at 12:09
add comment

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