Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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
up vote 11 down vote accepted

It's necessary to calculate the actual intersection, e.g.

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


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.