Messages crossed, but seems we agree ;)
On 07/04/2012 08:51 AM, Matej Mailing wrote:
I think I have just found it out. I just add ST_Intersection to have a
query like:
SELECT areas.id, SUM( ST_Length( ST_Intersection(lines.geometry,
areas.geometry) ) ) FROM lines,areas WHERE
ST_Intersects(line
Yes, you're right.
This should solve this problem:
SELECT areas.id, SUM( ST_Length( ST_Intersection( lines.geometry ,
areas.geometry ) ) )
FROM lines,areas
GROUP BY areas.id ;
ST_intersects returns true if there is an intersection and
ST_Intersection returns the share geometry.
Greetings,
I think I have just found it out. I just add ST_Intersection to have a
query like:
SELECT areas.id, SUM( ST_Length( ST_Intersection(lines.geometry,
areas.geometry) ) ) FROM lines,areas WHERE
ST_Intersects(lines.geometry,areas.geometry) GROUP BY areas.id ;
Now the numbers seem to be correct :-) Hop
Hi,
Thank you for the answer. However, I don't get the right result. For
example, when there is a line that is long 500 meters and it crosses 5
polygons (on each of them maybe just a meter or few meters, except one
where lies a majority of the line), I get the full length of the lines
for correspo
Hi,
You can use something like
SELECT areas.id, SUM( ST_Length( lines.geometry) ) FROM lines,areas
WHERE ST_Intersects(lines.geometry,areas.geometry) GROUP BY areas.id ;
Greetings,
Denis
On 07/03/2012 01:36 PM, Matej Mailing wrote:
Hi all,
We have a layer that contains polygons and anothe
Hi all,
We have a layer that contains polygons and another that contains lines
that lie on them. Parts of the lines are laying "inside" the polygons
and I would like to get a sum of all the lengths of lines that lie on
the polygons. What is the easiest way to achieve this?
TIA,
Matej