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.

How can I get the length (brown marked part) of the "Road 7" inside the red polygon?

a busy cat

My start:

SELECT ST_Length(way) FROM lines WHERE road = "Road 7" AND ST_Intersects(line, polygon)?

With that, I get only the total length :( Someone has an idea?

share|improve this question

1 Answer 1

up vote 9 down vote accepted

It's necessary to calculate the actual intersection, e.g. http://postgis.net/docs/ST_Intersection.html

SELECT ST_Length(ST_Intersection(line,polygon)) 
share|improve this answer
    
You beat me to it. +1 this should do it. –  GIS-Jonathan Jun 12 '12 at 11:26

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.