VERIFIED SOLUTION i

MapInfo Pro and calculating the length of a polyline contained within a polygon

Product Affected: Mapinfo Pro™
 

How to calculate the length of a polyline segment that is contained within a polygon when the polyline is drawn as one continuous object passing through many different polygons.

1. Make a copy of line table using File>Save Copy As...
2. Open the new copy of the line table via file>open.
3. Go to Table Maintenance > Table Structure and add a new column to the copy line table and call it SegmentLength. Select Float for the column's datatype and click OK.

4. Add the line table to the Mapper.

5. Click Table > Query > Select  and choose the line table in the first drop down.
-Store Results in Table: Selection
-Sort Results by Column: None
-Check: Find Results in Current Map Window
-Make sure the "Browse Results" checkbox is not checked and Click OK.
 
 User-added image

6. Make the line table editable in Layer Control.
 
7. Click on Spatial > Set Target and then Table >  Query > Select.

8. Choose the polygon table (in this example it's the USA table)
-Store Results in Table: "Selection"
-Sort Results by Column: "None"
-Check: "Find Results in Current Map Window"
-Make sure the "Browse Results" checkbox is not checked and Click OK.

User-added image
9. Now click on Spatial > Split and Click OK.

User-added image


10. Click on Home > Save Table and choose the Line table and click Save.

11. Then click Table > Edit > Update Column and Choose the Line table. Select the Length to update and get the value from the Line.
(See screenshot)

User-added image

12. Click on the Assist Button and then select "Object Len" and Click OK thru the dialogs.

13. The end result will update the length of each Polyline segment "split" by the polygon that contained it:

User-added image

14. Click on Table  > Maintenance > Table > Pack Table, Select the Line table and Pack "Both Types of Data".
User-added image

15. Click OK and Click Save.

16. Add the Line table back into the Mapper.

17. Click on Spatial > SQL Select

At "From Tables, choose the Fiber Line table first, and the polygon table second.

Choose "Within" as the operator and Click OK.

User-added image

The browser for the new Line table, with the polygon ID will be displayed.

18. Go to Home >  Save Copy As to save a copy of this query as a new table.

User-added image

Once saved,  go to Home > "Open Table" to open the new table into MapInfo.
Note: 64-bit versions of MapInfo Pro can open the saved copy automatically.

18. Go to Home > Open Table and choose the saved table, i.e.  Final_polyline_with_parcel_ID
 
19. Click on table  > maintenance > table  > Modify Structure
and remove any columns not desired in the table.

Each line is associated with a polygon ID from the polygon that the line falls within.

 

UPDATED:  July 23, 2019