Self intersecting polylines and overlay nodes bug. A question in two parts.

370 views
Skip to first unread message

college.atlas

unread,
Aug 10, 2012, 3:19:29 AM8/10/12
to mapi...@googlegroups.com
Folks I need some help.

I've written a nice routine for calculating chainages along a line to linearly index adjacent objects. It's worked for 100's of 1000's of objects but I've struck an unexpected exception to do with the source data.

The essential functionality is to draw a line from the adjacent object to the index line. Use Overlaynodes to create an intersecting point on the index line using the adjacent line and then test the index line with the overlayed node to see of the adjacent object node coordinates match. Works great.

However I have found an exception in the data. When the index line self intersects the whole process fails. This appears to be due to a bug in the overlay nodes function.

What happens if you have an index line that loops and and an intersecting line at any point along it's length is that the looped line gets broken into two sections. One section is the loop and the second object is the lead-in and lead-out lines joined end to end.

You can easily test this in a cosmetic layer.

Create a polyline that loops

Then draw an intersecting line

Select the looped line and make this the target.

Select the intersecting line and then select the menu Tools > Overlay Nodes

What you will be left with is the following.

A two section polyline (previously only one) that if disaggregated looks like this(See attached.)


This is a bug in my opinion. 

So I intended to work around the issue and find all the self intersecting polylines and eliminate them from the process.

HOWEVER contrary to the V8.5 manual stating

Detecting and Correcting Self-Intersections, Gaps, and Overlaps

To detect and correct self-intersections, gaps, and overlaps:

  1. Select the objects you want to work with.
Note: All of the objects selected must either be closed objects (for example, regions, rectangles, rounded rectangles or ellipses) or linear objects (for example, lines, polylines, or arcs). The selection can't contain a mixture of closed and linear objects. 


If I attempt to use the "Clean" Tool on my set I get the following error message

So folks does any one have any tips of finding self intersecting polylines?


Any help appreciated.






Overlaynodes.jpg

Tony Pilkington

unread,
Aug 10, 2012, 4:16:42 AM8/10/12
to mapi...@googlegroups.com
To test for self-intersecting lines, use intersectnodes.
 
 
Mapbasic commands typed into mapbasic window:
dim l1 as object
dim l2 as object
dim l3 as object
fetch first from selection
l1=selection.obj
l2=l1
l3=overlaynodes(l1,l2)
dim n1 as integer
dim n3 as integer
n1=objectinfo(l1,20)
print n1 gives 7
n3=objectinfo(l3,20)
print n3 gives 7
l3=intersectnodes(l1,l2,7)
n3=objectinfo(l3,20)
print n3 gives 8
 
To test for self-intersecting lines, use intersectnodes and check for a change in node count.
 
You will need to check to see if there is a change in node count if the line selfintersects at a coincident node pair.
 
----- Original Message -----
--
You received this message because you are subscribed to the
Google Groups "MapInfo-L" group.To post a message to this group, send
email to mapi...@googlegroups.com
To unsubscribe from this group, go to:
http://groups.google.com/group/mapinfo-l/subscribe?hl=en
For more options, information and links to MapInfo resources (searching
archives, feature requests, to visit our Wiki, visit the Welcome page at
http://groups.google.com/group/mapinfo-l?hl=en


No virus found in this message.
Checked by AVG - www.avg.com
Version: 2012.0.2197 / Virus Database: 2437/5189 - Release Date: 08/09/12

Self Intersecting line.jpg
Reply all
Reply to author
Forward
0 new messages