Discussion:
[Community] taking a difference between a linestring and a polygon
Benjamin Root
2014-11-19 21:00:21 UTC
Permalink
One can find the intersection between any geometry and a polygon to
effectively "clip" the geometry to be within the polygon. However, it
doesn't seem possible to "punch out" a region that intersects a non-polygon
geometry such as a line string. The difference() method just returns "self"
in those situations (and is documented as such).

Is there another way to get what I want?

Thanks!
Ben Root
Sean Gillies
2014-11-26 20:05:35 UTC
Permalink
Hi Ben,

Sorry to be so late. Does the code at prompt 18 in

http://nbviewer.ipython.org/gist/sgillies/7960d778f32ae8971053

help?
Post by Benjamin Root
One can find the intersection between any geometry and a polygon to
effectively "clip" the geometry to be within the polygon. However, it
doesn't seem possible to "punch out" a region that intersects a non-polygon
geometry such as a line string. The difference() method just returns "self"
in those situations (and is documented as such).
Is there another way to get what I want?
Thanks!
Ben Root
_______________________________________________
Community mailing list
http://lists.gispython.org/mailman/listinfo/community
--
Sean Gillies
Benjamin Root
2014-11-27 01:02:20 UTC
Permalink
Uh, yeah... I guess I should have just tried it instead of reading the
documentation: http://toblerity.org/shapely/manual.html#object.difference

"Shapely can not represent the difference between an object and a lower
dimensional object (such as the difference between a polygon and a line or
point) as a single object, and in these cases the difference method returns
a copy of the object named self."
Post by Sean Gillies
Hi Ben,
Sorry to be so late. Does the code at prompt 18 in
http://nbviewer.ipython.org/gist/sgillies/7960d778f32ae8971053
help?
Post by Benjamin Root
One can find the intersection between any geometry and a polygon to
effectively "clip" the geometry to be within the polygon. However, it
doesn't seem possible to "punch out" a region that intersects a non-polygon
geometry such as a line string. The difference() method just returns "self"
in those situations (and is documented as such).
Is there another way to get what I want?
Thanks!
Ben Root
_______________________________________________
Community mailing list
http://lists.gispython.org/mailman/listinfo/community
--
Sean Gillies
_______________________________________________
Community mailing list
http://lists.gispython.org/mailman/listinfo/community
Loading...