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.

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

Please help, thanks

share|improve this question

1 Answer 1

up vote 4 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 at 20:21

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.