gdal
gdal copied to clipboard
DGN driver: introduce DGN_CELL_HEADER_ORIGIN option to get only cell header's origin
What does this PR do?
This PR adds a new option DGN_CELL_HEADER_ORIGIN
to read just cell header's origin from DGN or DGNv8 files.
This PR only affects the DGN and DGNv8 drivers. Without the DGN_CELL_HEADER_ORIGIN
set, both driver's behavior is the same as before.
Cell headers are common. In the following example, cell headers are used for power towers, geodesic vertices, water tanks, etc.
Currently, each component of a cell is treated as a independent feature by ogr2ogr
. One original cell header is usually represented by several features (with different geometry types).
Get cell header's origin
This PR allows the extraction of the cell header's origin point and discard all the inner components. Only one point feature is created from a cell header. The remaining data, like user data linkage, are registered in this point feature. Cell's name is stored as the Text
property.
Test file
This 131_4mnt.zip can be used for testing purposes.
Converting DGN or DGNv8 files to Postgis
The example file can be converted to Postgis with the DGN driver with:
DGN_CELL_HEADER_ORIGIN=YES LD_LIBRARY_PATH=. CPL_DEBUG=ON ./apps/ogr2ogr -overwrite -skipfailures -f "PostgreSQL" PG:"service=gdal" -s_srs EPSG:3763 -t_srs EPSG:3763 -nln "dgn.131_4mnt" 131_4mnt.dgn
To test the DGNv8 driver, you need to disable the DGN driver with GDAL_SKIP=DGN
:
DGN_CELL_HEADER_ORIGIN=YES GDAL_SKIP=DGN LD_LIBRARY_PATH=. CPL_DEBUG=ON ./apps/ogr2ogr -overwrite -skipfailures -f "PostgreSQL" PG:"service=gdal" -s_srs EPSG:3763 -t_srs EPSG:3763 -nln "dgnv8.131_4mnt" 131_4mnt.dgn
Results
With this DGN_CELL_HEADER_ORIGIN=YES
option, we get points that can be properly tagged, according to other attributes.
The following example show the example DGN file converted to QGIS and then rendered properly, using the SVG graphics to render the point features, according to other attributes captured by ogr2ogr
.
Tasklist
- [ ] Add test case(s)
- [ ] Add documentation
- [ ] Review
- [ ] Adjust for comments
- [ ] All CI builds and checks have passed
Environment
Provide environment details, if relevant:
- OS: Ubuntu
- Compiler: gcc 8.5.0
The config option needs to be documented in dgn.rst and dgnv8.rst Added test in ogr_dgn.py and ogr_dgnv8.py for this new option would be great. Ideally with a data file as small as possible (has autotest/ogr/data/dgn/smalltest.dgn cell headers ?)
Option documented on both drivers.
We don't have yet a DGN file with cell headers in our code for testing. I'll try to prepare one for other small enhancements that I'm preparing.
this PR is stalled
@jgrocha ping w.r.t this stalled PR
@jgrocha Closing this PR due to inactivity and conflicts (likely due to the code reformatting). Please re-open / open a new one if needed