ST_Difference beetwwen multilinestring: Overlapping geometries

32 views
Skip to first unread message

giuseppe

unread,
Feb 27, 2015, 5:09:07 AM2/27/15
to spatiali...@googlegroups.com
I have two geometry table: A, A_clip: A_clip is a A clipped on a polygon layer.

I need to obtain the difference between A and A_clip


I use

SELECT ST_multi(ST_difference(A.geometry,A_clip.geom)) as geom
from A, A_clip

I see that output is not a perfect difference: many, many geometries from (A-A_clip) overlaps on A

Where I'am wrong??

a.fu...@lqt.it

unread,
Feb 27, 2015, 7:09:45 AM2/27/15
to spatiali...@googlegroups.com
Giuseppe,

there is no "layer" concept on Spatial SQL: what really happens
is that each feature from the first table will be evaluated against
any other feature from the second table (Cartesian Product) and
all individual results will be then inserted into the resultset.

you SQL snippets seems to be a little bit optimistic and simplistic;
just to say, I see no WHERE clause at all.

performing a quick visual inspection of the overall resultset
surely isn't the best way to properly debug your SQL query,
because there are lots of potentially harmful dataset-specific
conditions requiring a more careful evaluation.
just to enumerate the most obvious cases: duplicate items,
invalid geometries, partially overlapping items into the same
input table and so on.

I'll be glad to help you to resolve your problem, but I
absolutely need a copy of your tables in order to set up
a debugging session.
You can eventually send me your sqlite db-file in a
private mail.

bye Sandro

giuseppe

unread,
Feb 27, 2015, 9:27:19 AM2/27/15
to spatiali...@googlegroups.com
Thank you for you help. I will send my files as soon as I wil be in my office maybe on monday.
Good weekend
Reply all
Reply to author
Forward
0 new messages