0

I need to turn a line tab file into a point tab file using MapInfo (v15.2 x64). The lines represent routes, and I want the point table to have a point for each node in the line table, and a column holding the order it falls in the route.

The Point attribute table will look something like this:

Route,Latitude,Longitude,Order

A,12.314,-101.23,1

A,12.32,-101.33,2

A,12.41,-101.43,3

Is there a way to do this in the MapInfo UI?

1 Answer 1

1

A few months back I shared a small tool on MapInfo-l that would let you create points from selected polylines or polygons.

You can find the tool in this thread: Creating Node Points

Currently the tool does however not bring over any attributes from the original table. You would have to modify the tool slightly to make it do so. In the modifications mentioned below, I expect your route column to be called ROUTE:

  1. Add a variable for the Route name in line 130:

    Dim sQuery, sBaseTable, sTabFile, s2DTabFile, s2DTab, sRoute As String, 'Add sRoute to this line
        oCur As Object,
        nSegm, nNumSegms, nPnt, nNumPnts As Integer,
        aObj, aRoute As Alias, 'Add aRoute to this line
    
  2. Add the column to the new table in line 150:

    Create Table s2DTab
    (
        ROUTE Char(20), 'Add this line
        PNT Integer,
        X Float,
        Y Float,
        Z Float
    )
    
  3. Read the route name from the current record in line 167:

    aObj   = sQuery & ".OBJ"
    aRoute = sQuery & ".ROUTE" 'Add this line
    Fetch First From sQuery
    Do Until EOT(sQuery)
        oCur = aObj
        sRoute = aRoute 'Add this line
    
  4. Insert the route with the other values into the new table in line 185:

    Insert Into s2DTab
        (PNT, X, Y, ROUTE, OBJ) 'Add ROUTE to this line
        Values
        (nPnt, fX, fY, sRoute, CreatePoint(fX, fY)) 'Add sRoute to this line
    

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.