• Italiano
  • English

Home arrow User Guide
luned́, 22 luglio 2019
Dxf2PostGIS
User Guide
Dxf2PostGIS User Guide PDF Print

DXF2PostGIS – User Guide Version 1.2.x 

ImageHow to use user interface and description about output files.

Notes and caveats:

  • At present, DXF2PostGIS has been tested only with DXF files produced by the AutoCAD R12/LT2 version.- DXF2PostGIS has been tested with PostgreSQL/PostGIS database only in UTF8 encoding.
  • In the "layer" field every single-quote character ("'") is escaped by replacing it with two single-quotes ("''"), to conform to the SQL conventions.
  • Ditto for the "txt" field (for tables with _txt extension).- No other special characters are escaped in the "layer" or "txt" fields; it is therefore possible that some characters are interpreted as escape sequences in SQL.

Image

DXF fileType in or browse the file name you want to translate to SQL.When you save your DXF file from newer AutoCAD versions, remember to save as AutoCAD R12/LT2 version.

Image

Report fileThis file collects the names of generated SQL files, accompanied with remarks, warnings and errors occurred during the running.
SRIDSystem Reference ID. Leave default value (-1) if you don’t have or know a reference system for your data, otherwise type in the SRID number, according to the “spatial_ref_sys” table of your PostGIS database.
Also process all other DXF files in selected path (batch mode)When this option is selected, the program operates in batch mode: all the DXF files that are present in the same directory as the selected file will be processed.

When in batch mode, by default, for each DXF file an SQL file will be generated, containing “insert” statements to the same five tables. The corresponding SQL file name for “xxx.dxf” will be “xxx.sql”.

Generate one SQL file onlyCheck this option to alter the default behaviour of batch mode, to generate one big SQL file from all the DXF files. The single SQL file will be named as the DB tables name prefix + “.sql”.
Generate “create table” statementsCheck this option to emit the “create table” statements for the five tables where records will be inserted, or leave unchecked if you only want to append new records to the tables with the specified DB tables name prefix, i.e. the tables already exist.

When in batch mode, the “create table” statement will be only issued in the first SQL file generated. The first file mentioned in the report file is the one containing the “create table” statement.

Generate “create view” statementsThis option is used to create useful database views for every combination of layer and geometry type (point, line, polygon and text). A view will be created only where at least one record is present.

Each view will be named "v_xxx_yyy", where "xxx" is the layer name in lower case, with hyphen ("-") and space (" ") characters converted to underscore ("_") characters, and "yyy" corresponds to type extension ("pnt", "txt", "lin" and "plg").

Please note that when in batch mode, two or more layers that differ only by different case or by different use of separators ("-", " ", or "_") will be recognized as the same layer. The "layer" field values themselves will be stored unmodified.

For each new view, a record is also added in the "geometry_columns" table. This is useful to directly manage views as layer in other GIS and WebGIS software, e.g. Quantum GIS and UMN MapServer.

When this option is checked, Dxf2PostGIS will generate a SQL script file to create the required views (named "zzz_Views.sql", with "zzz" corresponding to the "DB tables name prefix") and it will create another SQL script file to drop those views (named "zzz_Views_drop.sql", with "zzz" corresponding to the "DB tables name prefix") and to delete corresponding records in the "geometry_columns" table.

No polygons (only linestrings) Check this option to generate "multilinestring" feature type instead  of "polygon" feature type.
DB tables name prefixDXF2PostGIS creates “insert” statements for inserting records into five tables. Type in the name prefix of the tables in this field.

The name will be used also to create another sql script (with extension “_drop.sql”), in order to restore the conditions previous the use of DXF2PostGIS.


The five tables, differ on their extensions, and are:

TableName_pntPOINT table type. In this table records are inserted coming from POINT, CIRCLE and INSERT AutoCAD entity type. Attributes recorded are:
  • gid (int4) – Primary key for geometry type table
  • path_file_dxf (varchar) – DXF file pathname
  • file_dxf (varchar) – DXF filename
  • handle (varchar) – AutoCAD object handle
  • layer (varchar) – AutoCAD layer name
  • block_name (varchar) – Block name (case INSERT only)
  • rotation (float8) – Rotation angle (case INSERT only)
  • radius (float8) – Radius (case CIRCLE only)
  • the_geom (geometry) – Point geometry
TableName_txtPOINT table type. In this table records are inserted coming from TEXT AutoCAD entity type. Attributes recorded are:
  • gid (int4) – Primary key for geometry type table
  • path_file_dxf (varchar) – DXF file pathname
  • file_dxf (varchar) – DXF filename
  • handle (varchar) – AutoCAD object handle
  • layer (varchar) – AutoCAD layer name
  • txt (varchar) – AutoCAD TEXT string
  • height (float8) – Text height
  • rotation (float8) – Text rotation angle
  • x_scale (float8) - Relative X scale factor-width (optional; default = 1).This value is also adjusted when fit-type text is used
  • thickness (float8) - Thickness (optional; default = 0)
  • oblique_angle (float8) - Oblique angle (optional; default = 0)
  • text_style (varchar) - Text style name (optional, default = STANDARD)
  • h_justif_type (int4) - Horizontal text justification type (optional, default = 0) integer codes (not bit-coded)
    • 0 = Left; 1= Center; 2 = Right
    • 3 = Aligned (if vertical alignment = 0)
    • 4 = Middle (if vertical alignment = 0)
    • 5 = Fit (if vertical alignment = 0)
  • v_justif_type (int4) - Vertical text justification type (optional, default = 0): integer codes (not bit- coded):         0 = Baseline; 1 = Bottom; 2 = Middle; 3 = Top
  • the_geom (geometry) – Point geometry
TableName_linMULTILINESTRING table type. In this table records are inserted coming from LINE, and open-end POLYLINE AutoCAD entity type. Attributes recorded are:
  • gid (int4) – Primary key for geometry type table
  • path_file_dxf (varchar) – DXF file pathname
  • file_dxf (varchar) – DXF filename
  • handle (varchar) – AutoCAD object handle
  • layer (varchar) – AutoCAD layer name
  • thickness (float8) - Thickness (optional; default = 0)
  • start_width (float8) - Default start width (optional; default = 0) (case INSERT only)
  • end_width (float8) - Default end width (optional; default = 0) (case INSERT only)
  • the_geom (geometry) – Multilinestring geometry
TableName_plgMULTIPOLYGON table type. In this table records are inserted coming from closed POLYLINE AutoCAD entity type. Attributes recorded are:
  • gid (int4) – Primary key for geometry type table
  • path_file_dxf (varchar) – DXF file pathname
  • file_dxf (varchar) – DXF filename
  • handle (varchar) – AutoCAD object handle
  • layer (varchar) – AutoCAD layer name
  • thickness (float8) - Thickness (optional; default = 0)
  • start_width (float8) - Default start width (optional; default = 0) (case INSERT only)
  • end_width (float8) - Default end width (optional; default = 0) (case INSERT only)
  • the_geom (geometry) – Multipolygon geometry
TableName_layIn this table records are inserted coming from AutoCAD “LAYER” table. Attributes recorded are:
  • id (int4) – Primary key
  • path_file_dxf (varchar) – DXF file pathname
  • file_dxf (varchar) – DXF filename
  • sub_class_marker (varchar) – sub_class_marker (AcDbLayerTableRecord)
  • layer (varchar) – AutoCAD layer name
  • iflags (int4) - Standard flags (bit-coded values):
  • 1 = Layer is frozen; otherwise layer is thawed
  • 2 = Layer is frozen by default in new viewports
  • 4 = Layer is locked
  • 16 = If set, table entry is externally dependent on an xref
  • 32 = If both this bit and bit 16 are set, the externally dependent xref has been successfully resolved
  • 64 = If set, the table entry was referenced by at least one entity in the drawing the last time the drawing was edited. (This flag is for the benefit of AutoCAD commands. It can be ignored by most programs that read DXF files and need not be set by programs that write DXF files)
  • flg_frozen (bool) - Layer is frozen
  • flg_frz_default bool) - Layer is frozen by default in new viewports
  • flg_locked (bool) - Layer is locked
  • flg_dep_xref (bool) - table entry is externally dependent on an xref
  • flg_dep_xref_ok (bool) - the externally dependent xref has been successfully resolved
  • flg_plot (bool) - If set to false, do not plot this layer
  • color_num (int4) - Color number (if negative, layer is off)
  • rgb (varchar) – RGB color (blank delimited)
  • flg_on (bool) – layer is on
  • line_type_name (varchar) – Linetype name
  • lineweight (varchar) – Lineweight enum value
  • hard_pointer_id (varchar) - Hard-pointer ID/handle of PlotStyleName object
 
© 2019 GLASIC