MapInfo Pro

Expand all | Collapse all

Creating lines from table data against an existing polyline

  • 1.  Creating lines from table data against an existing polyline

    Posted 10 days ago
    Hi,

    I have a table of polylines representing roads from start to end and another table that represents segments that make up the road.  The segment table only has lengths, no other spatial data.  I want to loop through the segments using the roadname as a key and create lines using the polyline nodes.

    Does anyone have any suggestions on how to approach.

    Thanks

    ------------------------------
    Stephen Perger
    Buloke Shire Council
    Wycheproof VIC
    ------------------------------


  • 2.  RE: Creating lines from table data against an existing polyline

    Posted 8 days ago
    I wouldn't know how to approach, but just as an observation if your road names are anything like ours there will be duplicates, in which case I'd use a more unique ID, however the process works.

    ------------------------------
    Martin Burroughs
    Oldham Council
    ------------------------------



  • 3.  RE: Creating lines from table data against an existing polyline

    Posted 8 days ago
    Thanks Martin,

    we have unique IDs, I'm really after a technical answer on how to perform with mapbasic or Python.

    The segment data is from our Condition inspection contractor Moloneys, so hoping that someone from Aussie councils may be willing to share the coding required.

    ------------------------------
    Stephen Perger
    Buloke Shire Council
    Wycheproof VIC
    ------------------------------



  • 4.  RE: Creating lines from table data against an existing polyline

    Posted 7 days ago
    Hi Stephen

    I can not provide you with a working solution but point you towards some MapBasic functions that might come in handy.

    A while back, I created a function that allows you to create a point along a polyline.
    It takes a polyline, the distance along, and a potential offset distance (left is negative and right is positive).

    Function OBJCartesianCreatePointAlong(
          ByVal oPolyline As Object 'The polyline to create the point along

       , ByVal fDistance As Float 'Distance along polyline, can also be negative
       , ByVal fOffset As Float 'Offset from polyline, negative is left, positive is right
       ) As Object

    This could be used as a starting point for finding the points along your roads.

    You'll probably need some other functions, too. For example, one to add a new node to the polyline and another to find the Id of the node just added.

    Here's an idea to get you started:
    1. For the two lengths do this
       1a. Create a new point along the polyline using OBJCartesianCreatePointAlong.
       1b. Add this point as a new node to the polyline using OBJAddNodeOnPolyline.
       1c.  Find the number of the just inserted new node using OBJFindNodeBinary.
       All these functions can be found in the OBJLib (part of the mbLibrary) on Github.
    2. Finally use the MapBasic ExtractNodes function to extract the polyline segments from the full polyline.

    One thing that can make this more tricky:
    Your roads are made up of multiple polylines. To find the position of 1,500, you maybe have to use the second or third polyline and not the first.


    ------------------------------
    Peter Horsbøll Møller
    Principal Presales Consultant | Distinguished Engineer
    Precisely | Trust in Data
    ------------------------------