MapInfo Pro Developers User Group

Expand all | Collapse all

OverlayNodes and IntersectNodes

  • 1.  OverlayNodes and IntersectNodes

    Posted 14 days ago
    Hi
    Using MB17 and MapInfo v17.02
    I have 2 polylines (although only 2 pnts) that cross another polyline.
    I'm trying to get the points along the main line between the two crossing lines.
    But quite often the overlaynodes and intersectnodes does not return anything.

    Basically I use:

     'add nodes to base line
     oBaseline = OverlayNodes(oBaseline,oLineStart)
    'repeat other cross line
     oBaseline = OverlayNodes(oBaseline,oLineEnd)
    PntStart = IntersectNodes(oBaseline,oLineStart, INCL_CROSSINGS)
    PntEnd = IntersectNodes(oBaseline,oLineEnd, INCL_CROSSINGS)

    But occasionally PntStart or PntEnd has no points, as in the case below, the top crossing line hasn't generated any nodes on the vertical base line..

    Has anyone else had this problem?
    If I do the process manually within MapInfo it works.

    Cheers
    David

    ------------------------------
    David Wilson
    Buchanan Computing
    London, UK
    ------------------------------


  • 2.  RE: OverlayNodes and IntersectNodes

    Posted 13 days ago
    Hi David

    Could it be something as basic as not specifying the coordinate system?

    ------------------------------
    Peter Horsbøll Møller
    Distinguished Engineer
    Pitney Bowes Software & Data
    ------------------------------



  • 3.  RE: OverlayNodes and IntersectNodes

    Posted 13 days ago
      |   view attached
    Hi Peter,
    Unfortunately not, the coordinate system is set.
    In this particular case I'm using 2 kerb lines and splitting them by 4 cross lines, so calling this routine 4 times. It fails about once out of 4 occasions.
    All the objects are usually derived objects stored in variables, not based on objects from an actual table.
    I've basically taken the MapX code I had using 'FeatureFactory.IntersectionTest' and 'FeatureFactory.IntersectionPoints' and moved it into MapBasic.
    I've attached some of the geometry code used, but the same procedure works on some lines but not others.
    Cheers
    David


    ------------------------------
    David Wilson
    Buchanan Computing
    London, UK
    ------------------------------

    Attachment(s)

    txt
    OverlayNodeTest.txt   7K 1 version


  • 4.  RE: OverlayNodes and IntersectNodes

    Posted 13 days ago

    Hi David

    I think the solution lies in the difference between the different attributes for the IntersectNodes function.

    • INCL_CROSSINGS: Returns points where segments cross.
    • INCL_COMMON: Returns end-points of segments that overlap.
    • INCL_ALL: Returns points where segments cross and points where segments overlap.

    If you create a new node at the intersections, I think MapInfo sees this as an overlap, not as a crossing.

    I tried changing your statements from:

    PntEnd = IntersectNodes(oBaseline,oLineEnd, INCL_CROSSINGS) 

    to

    PntEnd = IntersectNodes(oBaseline,oLineEnd, INCL_ALL)

    That seemed to fixed the problem where you didn't find the node at the overlap.

    Let us know if you see the same improvement.



    ------------------------------
    Peter Horsbøll Møller
    Distinguished Engineer
    Pitney Bowes Software & Data
    ------------------------------



  • 5.  RE: OverlayNodes and IntersectNodes

    Posted 13 days ago
    Hi Peter,
    Many thanks that has worked.
    I don't see why the INCL_CROSSING worked occasionally even when there was a node present. I had added nodes for both lines prior to using the IntersectNodes function and it sometimes worked.
    But I'll change it to INCL_ALL anyway as that works consistently.

    Cheers
    David

    ------------------------------
    David Wilson
    Buchanan Computing
    London, UK
    ------------------------------