Jump to content

Joining a MI table with a blank TF 1d_nwk table

Recommended Posts


I have a Mapinfo table which contains my 1D network attributes.

I would like to join this table to a blank TF 1d_nwk table, so that the fields (and values) in the Mapinfo table are appended to the fields in the TF table.

Simply copying the features from the Mapinfo table and pasting these into the TF table just overwrites the TF fields with the Mapinfo values.

Does anyone know how to do this? (If that makes sense)



Share this post

Link to post
Share on other sites

Hi Paul,

BMT WBM is currently developing a tool that will do as you describe and will be included as part of the miTools package in the future.

For more information regarding this tool or the miTools in general please contact mitools@tuflow.com

Cheers, Joel

Share this post

Link to post
Share on other sites

Hi Paul

To append two tables or a Selection (Query) to a table, use the Table, Append Rows to Table... dialog. If both have the same number and type of attributes (in the same order) this should work fine. If the appended data has more attributes the data for the extra attributes is lost, while if the appended data has less attributes no data is lost.

As an aside, when viewing time-series data in MapInfo using the miTools graphing tool with _TS.mif layers, a very useful thing to do is append one _TS.mif layer to another one (eg. "before" and "after" simulations). This way you can select _TS.mif output points from the combined layer and plot both curves on the same graph allowing easy comparison of results. When selecting the points you need to select both points (they'll be on top of each other and the "Marquee Select" tool is best for this). An additional tip is to readily distinguish which simulation each curve comes from in the graph legend, before appending it is a good idea to prefix the ID of one of the layers using Table, Update Columns... dialog (Column to Update is ID and in Value enter, say, "A "+ID to add the letter A (for Case A) to the front of the ID label.



Share this post

Link to post
Share on other sites


My original post was not very clear. My Mapinfo (MI) table containing 1D network elements comes from Council's database. I want to append (‘append’ in the true sense) this to the TF 1D_nwk table, and not over-write fields in the TF 1D_nwk table, but join the two tables so that no fields are lost.

Two reasons for doing this are:

Council's ID for network elements contain more characters than the TF ID's 12 character limit, so I previously truncated the Council ID. Joining the Council table to the TF table allows me to keep the full Council ID for future TF model updates;

Changes are always needed to TF 1D elements (eg, tweaking ground levels), and having the original values joined to the TF 1d_nwk table provides a good record of the original database values, and changes that have been made.

Joel, thanks for your reply. Definitely this following method will become redundant at some point. But for now here's how I've done it:

Step 1: Open your table containing the base data in MI, then File | Save Copy As..., save with the appropriate TF prefix (eg, 1d_nwk_..., or 1d_mh_...)

Step 2: Open this newly named/saved table in MI.

Step 3: Open the MI MapBasic Window (from Options | Show MapBasic Window)

Step 4: Paste the following command lines into the MapBasic Window:

For 1d_nwk_... paste

Alter Table "1d_nwk_XXX" ( add ID Char(12),Type Char(4),Ignore Logical,UCS Char(1),Len_or_ANA Float,n_or_n_F Float,US_Invert Float,DS_Invert Float,Form_Loss Float,pBlockage Float,Inlet_Type Char(12),Conn_2D Char(4),Conn_No Integer,Width_or_Dia Float,Height_or_WF Float,Number_of Integer,Height_Cont Float,Width_Cont Float,Entry_Loss Float,Exit_Loss Float order ID,Type,Ignore,UCS,Len_or_ANA,n_or_n_F,US_Invert,DS_Invert,Form_Loss,pBlockage,I


ont,Entry_Loss,Exit_Loss) Interactive

For the new 1d_mh_... paste

Alter Table "1d_mh_YYY" ( add ID Char(12),Loss_Approach Char(4),Ignore Logical,ANA Float,Ground_Level Float,Invert_Level Float,Flow_Width Float,K_Fixed Float,Km Float,Conn_2D Char(4),pBlockage Float,R1 Float,R2 Float,R2_2 Float order ID,Loss_Approach,Ignore,ANA,Ground_Level,Invert_Level,Flow_Width,K_Fixed,Km,Conn

_2D,pBlockage,R1,R2,R2_2) Interactive

Note: when the command line is pasted into the MapBasic window, it should appear as one single line with no returns.

Step 5: In the command line above, insert the correct table name into the quotes (eg, replace "1D_mh_YYY" with your table name)

Step 6: Click at the end of the above command line (just after the ‘Interactive’ command), and hit return (enter). This should insert all the correct TF fields, and then re-order them so that they are at the top of the table in the correct order.

Note: if your original data table has too many fields, when you join it to the TF 1D_nwk_ or 1D_mh_ tables, TF may mistake it for a 1d_nwke_ table. The total number of fields to be joined should not exceed the number of additional fields in the 1d_nwke_ table (see TF manual).

Step 7: Use Table | Update Column, to copy the values from your joined fields into the above TF fields.

Hope this helps. Let me know if I’ve missed something.



Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...