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.
closed as not a real question by underdark♦ Mar 21 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, see the FAQ.
? 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