[gdal-dev] GSoC GDAL DWG Support [Week 4]

Even Rouault even.rouault at spatialys.com
Sun Jun 19 06:57:33 PDT 2016


Александр,

Great to see your progress.

Here's a commit to fix a compilation issue:
https://github.com/rouault/gdal_libopencad/commit/0f2a5205ad5e4aaa55283c43c134a3683a60c8b6

> 
> Also, I would like to know which DWG file things would devs like to see in
> Feature attributes fields? Now it contains Thickness, Color (RGB),
> CADGeometryType, ExtendedEntityData (not supported by library yet).

Regarding styling, do you intend exposing it as attributes or using OGR 
feature style strings like in the DXF or the Teigha DWG driver ?
> 
> - All libopencad's file I/O was rewritten using VSIF.

I tried the following :

from osgeo import gdal, ogr
data = open('libopencad/tests/data/r2000/triple_circles.dwg').read()
gdal.FileFromMemBuffer('/vsimem/foo.dwg', data)
ds =ogr.Open('/vsimem/foo.dwg')

and got a crash :

Program received signal SIGSEGV, Segmentation fault.
_IO_fread (buf=0x7fffffffd5b0, size=1, count=6, fp=0x0) at iofread.c:43
43	iofread.c: Aucun fichier ou dossier de ce type.
	in iofread.c
(gdb) 
(gdb) bt
#0  _IO_fread (buf=0x7fffffffd5b0, size=1, count=6, fp=0x0) at iofread.c:43
#1  0x00007ffff52fb13c in VSIFRead (pBuffer=0x7fffffffd5b0, nSize=1, nCount=6, 
fp=0x0) at cpl_vsisimple.cpp:230
#2  0x00007ffff5433a79 in CADFileStreamIO::Read (this=0xa48750, ptr=0x7fffffffd5b0, 
size=6) at cadfilestreamio.cpp:109

So I saw you indeed use the VSIF API, and not the VSIF*L API (VSIFOpenL(), 
etc....). The former is just a wrapper around the C standard FILE operations, 
while the later uses the GDAL virtual file system handlers to have in-memory 
file (/vsimem/), compressed file (/vsizip/, /vsitar/) or remote files (/vsicurl/)

Other things I've tried :

* numerous compiler warnings.

* "valgrind --leak-check=full ogrinfo -ro -al -q 
libopencad/tests/data/r2000/triple_circles.dwg" shows some memory leaks

* "test_ogrsf -ro libopencad/tests/data/r2000/triple_circles.dwg": a number of 
errors regarding taking into attribute & spatial filters (see 
OGRDXFLayer::GetNextFeature() for the usual way of taking into account 
filters), and finally a crash. test_ogrsf is a kind of "conformance" testing for 
OGR drivers. You need to "cd apps; make test_ogrsf" to build it.


Even

-- 
Spatialys - Geospatial professional services
http://www.spatialys.com


More information about the gdal-dev mailing list