Difference between revisions of "12da to from GIS"

From Tuflow
Jump to navigation Jump to search
(Added some extra information on UTF16 conversion.)
(6 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
=Introduction=
 
=Introduction=
'''12da_to_from_GIS.exe''' converts .12da files from the 12D software [http://www.12d.com (www.12d.com)] to and from .mif and .shp files.  If importing/exporting to/from 12D and a GIS simply specify the file that you wish to have translated.  If the file has a .12da (or a .4da) extension, the program converts it to a .mif/.mid file format.  If the file has a .mif extension, the program converts it to a .12da file.<br>
+
'''12da_to_from_GIS.exe''' converts .12da files from the 12D software [http://www.12d.com (www.12d.com)] to and from .mif and .shp files, the .12da file needs to be in ANSI encoding, not UTF.  If importing/exporting to/from 12D and a GIS simply specify the file that you wish to have translated.  If the file has a .12da (or a .4da) extension, the program converts it to a .mif/.mid file format.  If the file has a .mif extension, the program converts it to a .12da file.<br>
 
Note, when converting from a .12da file to a .mif file without any options, 12da_to_from_mif automatically creates a .mif/.mid file suitable for use by Read GIS Z Line.  This is useful for importing 3D breaklines (eg. of a road design) directly into TUFLOW.<br>
 
Note, when converting from a .12da file to a .mif file without any options, 12da_to_from_mif automatically creates a .mif/.mid file suitable for use by Read GIS Z Line.  This is useful for importing 3D breaklines (eg. of a road design) directly into TUFLOW.<br>
 
There are some very useful options as discussed in the table below.<br>
 
There are some very useful options as discussed in the table below.<br>
Line 30: Line 30:
 
*Export the 3D draped polylines from 12D as a .12da file.
 
*Export the 3D draped polylines from 12D as a .12da file.
 
*Run 12da_to_from_gis using the -xs option.  For example:<br>
 
*Run 12da_to_from_gis using the -xs option.  For example:<br>
:<tt>12da_to_from_gis.exe -xs xs_draped.12da</tt><br>
+
:<tt>12da_to_from_gis.exe -xs -shp xs_draped.12da</tt><br>
:This will produce a 1d_xs layer ready for use by TUFLOW and a .csv file for each cross-section line.  Keep the 1d_xs layer and the .csv files in the same folder in the event that you move them elsewhere.<br>
+
:This will produce a 1d_xs layer in shapefile format ready for use by TUFLOW and a .csv file for each cross-section line.  Keep the 1d_xs layer and the .csv files in the same folder in the event that you move them elsewhere.<br>
 
Using the xsGenerator.exe utility, you can also assign material values to each of the cross-section points (see <u>[[xsGenerator | this page]]</u>).
 
Using the xsGenerator.exe utility, you can also assign material values to each of the cross-section points (see <u>[[xsGenerator | this page]]</u>).
 
|}
 
|}
Line 44: Line 44:
 
This creates 3D breakline .mif/.mid files of the TUFLOW HX lines that can be used to ensure the 2D HX cells are set to the exact elevations along the HX lines by using the below command in the .tgc file.:<br>
 
This creates 3D breakline .mif/.mid files of the TUFLOW HX lines that can be used to ensure the 2D HX cells are set to the exact elevations along the HX lines by using the below command in the .tgc file.:<br>
 
<tt>Read GIS Z Line THICK == mi\2d_hx_lines_draped.12da.mif </tt><br>
 
<tt>Read GIS Z Line THICK == mi\2d_hx_lines_draped.12da.mif </tt><br>
 +
 +
=Frequently Asked Questions (FAQ)=
 +
==Why are the SHP or MIF files created by the 12da_to_from_GIS utility empty?==
 +
The reason for empty output files may be that 12D (v10 or later) produces output files in UTF-16 encoding by default. This encoding is not compatible with the utility and can lead to empty SHP or MIF outputs.  The .12da can be exported from 12D into ANSI format, or readily converted in text editor from UTF16 to ANSI making it compatible with TUFLOW and TUFLOW utilities.  Instructions for both methods are below. <br>
 +
In 12D, when exporting the TIN as a .12da file, make sure to select the "[Ansi format]"<br>
 +
[[File:12da_TIN_export_screenshot.JPG|500px]] <br>
 +
This change will be highlighted at the bottom of the Write 12da pop up box. See figure below. <br>
 +
[[File:12da_TIN_export_screenshot_ANSI_Format_set.JPG|500px]] <br><br>
 +
 +
Alternatively, an existing .12da file can  easily be converted to ANSI encoding in Notepad++, under the Encoding menu: <br>
 +
[[File:Convert ANSI.jpg|500px]]
 +
  
 
{{Tips Navigation
 
{{Tips Navigation
 
|uplink=[[TUFLOW_Utilities | Back to TUFLOW Utilities]]
 
|uplink=[[TUFLOW_Utilities | Back to TUFLOW Utilities]]
 
}}
 
}}

Revision as of 14:53, 30 October 2023

Introduction

12da_to_from_GIS.exe converts .12da files from the 12D software (www.12d.com) to and from .mif and .shp files, the .12da file needs to be in ANSI encoding, not UTF. If importing/exporting to/from 12D and a GIS simply specify the file that you wish to have translated. If the file has a .12da (or a .4da) extension, the program converts it to a .mif/.mid file format. If the file has a .mif extension, the program converts it to a .12da file.
Note, when converting from a .12da file to a .mif file without any options, 12da_to_from_mif automatically creates a .mif/.mid file suitable for use by Read GIS Z Line. This is useful for importing 3D breaklines (eg. of a road design) directly into TUFLOW.
There are some very useful options as discussed in the table below.
Of particular note is the -xs option to generate a TUFLOW 1D cross-section database from a 12D DTM. This approach is far more preferable to extracting cross-sections manually and is much better than extracting cross-sections from a grid based DTM (eg. Vertical Mapper or Spatial Analyst) as it only extracts points where the DTM triangle sides intersect the cross-section line, thereby keeping the number of points in the cross-section profile to a minimum, and also improving the accuracy of the profile.
The zln option can also be very useful when the DTM river bathymetry is poor because the aerial survey is inaccurate where there is water or dense vegetation, and you need to carve a section through the DTM along the river based on a cross-section survey.

Options (switches)

TABLE 1: 12da_to_from_GIS Options (Switches)

Switch Description
When converting from a .mif file to a .12da file
"-zln" When converting a .mif file to .12da file, if zln is specified polylines are interpreted in the same manner as a TUFLOW 3D breakline (see Read GIS Z Line) such that any points snapped to the polyline are used to set the elevations of any vertices along the polyline that do not have points snapped to them. The first attribute in the .mif file must be the Elevation. (Note, when converting in reverse from a .12da file to a .mif file without any options, 12da_to_from_mif automatically creates a .mif/.mid file suitable for use by Read GIS Z Line.)

This is useful for creating 3D polylines for 12D where an elevation does not exist at a vertice. It is particularly useful where a river’s bathymetry in a DTM is being created from cross-section surveys, and the DTM operator wishes to use the elevations at the cross-section survey points, but needs to put more shape into the breaklines being digitised between the cross-sections so as to carve out the river’s bathymetry into the DTM. Using 12da_to_from_mid with the zln option will interpolate elevations at every string vertice, something that 12D does not offer (as far as we know!).

When converting from a .12da file to a .mif file
"-hip" When converting a .12da file to a .mif file will include any 12D hipdata polylines.
"-xs" When converting a .12da file to a .mif file creates a TUFLOW cross-section database (ie. one .csv file per 3D polyline) and a 1d_xs layer (1d_tab or 1d_xs format – see Read GIS Table Links and Section 4.6.3). This is used to extract 1D cross-sections from a DTM for use in TUFLOW. Cross-sections generated this way can also be viewed and edited in the SMS TUFLOW Interface.

The process to create the cross-sections from a 12D DTM is as follows:

  • Digitise the location of cross-section lines either in a GIS or in 12D. If in a GIS, export the layer out as a .mif file and then run 12da_to_from_gis to convert the .mif file into a .12da file. For example use:
12da_to_from_gis.exe xs.mif
to generate a file called xs.12da. Import the .12da file into 12D.
  • In 12D drape the cross-section polylines over the DTM (your 12D operator should know how to do this!) to create 3D polylines with vertices where the cross-section line intersects a DTM triangle edge.
  • Export the 3D draped polylines from 12D as a .12da file.
  • Run 12da_to_from_gis using the -xs option. For example:
12da_to_from_gis.exe -xs -shp xs_draped.12da
This will produce a 1d_xs layer in shapefile format ready for use by TUFLOW and a .csv file for each cross-section line. Keep the 1d_xs layer and the .csv files in the same folder in the event that you move them elsewhere.

Using the xsGenerator.exe utility, you can also assign material values to each of the cross-section points (see this page).

Examples

12da_to_from_gis.exe -mif road_breaklines.12da
creates .mif/.mid files of the 2D and 3D breaklines in the file road_breaklines.12da. The .mif/.mid files can be directly used by Read GIS Z Line.

12da_to_from_gis.exe 2d_hx_lines.mif
creates a file 2d_hx_lines.mif.12da. Import this file into 12D then drape these lines over the DTM and export the file, say as 2d_hx_lines_draped.12da, then execute the following:
12da_to_from_gis.exe 2d_hx_lines_draped.12da
This creates 3D breakline .mif/.mid files of the TUFLOW HX lines that can be used to ensure the 2D HX cells are set to the exact elevations along the HX lines by using the below command in the .tgc file.:
Read GIS Z Line THICK == mi\2d_hx_lines_draped.12da.mif

Frequently Asked Questions (FAQ)

Why are the SHP or MIF files created by the 12da_to_from_GIS utility empty?

The reason for empty output files may be that 12D (v10 or later) produces output files in UTF-16 encoding by default. This encoding is not compatible with the utility and can lead to empty SHP or MIF outputs. The .12da can be exported from 12D into ANSI format, or readily converted in text editor from UTF16 to ANSI making it compatible with TUFLOW and TUFLOW utilities. Instructions for both methods are below.
In 12D, when exporting the TIN as a .12da file, make sure to select the "[Ansi format]"
12da TIN export screenshot.JPG
This change will be highlighted at the bottom of the Write 12da pop up box. See figure below.
12da TIN export screenshot ANSI Format set.JPG

Alternatively, an existing .12da file can easily be converted to ANSI encoding in Notepad++, under the Encoding menu:
Convert ANSI.jpg


Up
Go-up.png Back to TUFLOW Utilities