Le lundi 26 janvier 2015 15:18:43, Jukka Rahkonen a écrit : > Spotted from gis.stackexchange: > > http://gis.stackexchange.com/questions/131765/ogr-dxf-closed-polyline-conve > rsion > > The DXF driver documentation claims that closed polylines from DXF are > converted into polygons but that does not seem to happen. By comparing the > DXF snipped from stackexchange > > ENTITIES > 0 > LWPOLYLINE > 5 > 20000 > 8 > 0 > 100 > AcDbEntity > 100 > AcDbPolyline > 70 > 1 > 90 > 4 > > with a DXF specification > http://www.autodesk.com/techpubs/autocad/acad2000/dxf/lwpolyline_dxf_06.htm > I can read that LWPOLYLINE [code 70] is defined with flag 1 [closed]. But > could someone interpret what does it mean in GIS context? Should a closed > CAD polyline be translated into LINEARRING or POLYGON in WKT?
Jukka, It seems the documentation matches the initial implementation but has been outdated by later changes. Indeed, ogr/ogrsf_frmts/dxf/ogrdxflayer.cpp contains the following (disabled) code : /* -------------------------------------------------------------------- */ /* If polyline is closed, convert linestring to a linear ring */ /* */ /* Actually, on review I'm not convinced this is a good idea. */ /* Note that most (all) "filled polygons" are expressed with */ /* hatches which are now handled fairly well and they tend to */ /* echo linear polylines. */ /* -------------------------------------------------------------------- */ #ifdef notdef if(m_bClosed) { OGRLinearRing *poLR = new OGRLinearRing(); poLR->addSubLineString( poLS, 0 ); delete poLS; // Wrap as polygon. OGRPolygon *poPoly = new OGRPolygon(); poPoly->addRingDirectly( poLR ); return poPoly; } #endif Only HATCH (as well as 3DFACE and SOLID) objects are converted as Polygon. Even > > -Jukka Rahkonen- > > > > _______________________________________________ > gdal-dev mailing list > gdal-dev@lists.osgeo.org > http://lists.osgeo.org/mailman/listinfo/gdal-dev -- Spatialys - Geospatial professional services http://www.spatialys.com _______________________________________________ gdal-dev mailing list gdal-dev@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/gdal-dev