wiki:DWG_driver

Version 1 (modified by Bishop, 8 years ago) ( diff )

DWG driver GSoC 2016 first commit

GDAL DWG file format support

Short description

An implementation of new OGR Driver with capability to read DWG file format. Driver will be based on a newly written open-source library under X/MIT license.

Introduction

Current state of GDAL: There is DWG support, which contradicts with GDAL ideology:

  1. It depends on third-party library (Teigha), which is not OpenSource.
  2. Current DWG Driver is not built-in in GDAL 2.0 by default, and is not maintained for years.
  3. There are a few external libraries, that can provide abilities to work with DWG, but they can’t be used in GDAL for a variety of reasons:
  • libdwg - abandoned project
  • libredwg - GPLv3 incompatible with GDAL X/MIT
  • libdxfrw - GPLv2 incompatible with GDAL X/MIT.

To sum up, there is a real need in creating a driver without any third-party dependencies, which can go forward with X/MIT ideology.

Main ideas

Write a new library to read DWG files

  • Library should be written in an easy-to-extend style, so every DWG/DXF version can be handled easily.
  • Library should provide a clear API how to interact with it, and an easy method to write OGR Driver based on it.
  • Library should has an abstract data model for all DWG/DXF files of any version (so, DXF format also could be added to the library).

GDAL Driver

Implement a new DWG driver for OGR, which will work with libopencad. The driver should support some options, i.e. explode blocks, etc. All DWG/DXF header variables should be mapped to driver metadata. Reading the DWG/DXF files should be organised via GDAL VSI/CPL functions. The libopencad sources needed for driver will be merged to GDAL sources.

Plan & Timeline

  1. Before May 28: Complete creating File Map of DWG R2000, which will allow to easily get Geometries from specific layer. Reading Layers attributes. Write google tests for file opening errors handling, reading geometries of each type.
  1. May 28 - June 4: Write google tests for correct opening of large files with big amount of geometries and layers.
  1. June 5 - June 12: Implement doxygen, start working on library API and internal methods description.
  1. June 13 - June 20: Implement reading of attributes for geometries and objects, as they are separated from geometries/objects data structures.
  1. June 21 - June 28: Start writing OGR Driver (DXF driver will be as an example) for DWG file format handling and integrating libopencad in it. Add basic OGR style support.
  1. June 29 - July 6: Start adding DWG R13-14 formats support to libopencad. Working on last week tasks.
  1. July 7 - July 14: End of adding DWG R13-14 formats support to libopencad. Start testing new OGR DWG Driver for its capabilities to Identify DWG files, reading features from it.
  1. July 15 - July 22: Implement Valgrind to find actual memory leaks in libopencad, as well as in OGR Driver and fix them.
  1. July 23 - 30: Start writing documentation for new OGR Driver. Start code refactoring of libopencad codebase for production level.
  1. July 31 - August 7: End code refactoring. End writing documentation. Write GDAL Autotests for new driver.
  1. August 8 - August 15: Fix possible errors found by autotests. Sumbit a pull request to GDAL Trunk.

Future ideas

Support for writing ability - creating CAD files is more complicated than reading, but with good library/driver architecture it will be possible without any painful refactoring. Not all DWG format versions will be handled during GSoC, so adding support to them will also be a good extension.

Project progress

All progress made can be viewed there:

Github: ​https://github.com/sandyre/libopencad (CAD support library)

Blog: ​http://gsoc2016gdaldwg.blogspot.ru

Note: See TracWiki for help on using the wiki.