4

I have a problem with intersection function. I built my query following http://manual.linfiniti.com/en/postgis/geometry.html, 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

query:

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),
  b.geom));

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

1 Answer 1

6

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.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.