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

I have a problem with intersection function. I built my query following, 5.7 section.

I made my clip object, a red linestring frame:

enter image description here

But after the clip(intersect) operation, something is wrong: enter image description here


create table roads_clip as
select st_intersection(a.geom, b.geom), b.*
from clip as a, roads as b
where not st_isempty(st_intersection(st_setsrid(a.geom,23700),

Roads layer contains multiline object and intersection cut roads where intersects the red frame.

I would like a result similar to this: enter image description here

share|improve this question
up vote 6 down vote accepted

Clip and Intersect are two similar, but different operations, but that's not your problem here. It looks to me like your Intersect worked fine, the problem is that the shape you're Intersecting with, the red frame, is a line object and not a polygon. So, the only road segments being output are the ones that directly touch that line. If you want to clip the roads to just those segments inside the polygon, make the red frame shape a polygon rather than a line feature and try again. I don't have PostGIS experience so I can't help with that part but if your red frame is a line like you said, making it a polygon should solve the problem.

share|improve this answer
it works, thanks so much – Balazs Feb 6 '14 at 20:21

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.