Opened 7 years ago
Closed 7 years ago
#7005 closed enhancement (fixed)
DXF: Allow user to set the tolerance used when joining parts of a hatch boundary
Reported by: | Alan Thomas | Owned by: | warmerdam |
---|---|---|---|
Priority: | normal | Milestone: | |
Component: | OGR_SF | Version: | svn-trunk |
Severity: | normal | Keywords: | dxf |
Cc: |
Description
The attached DXF file is part of a real-world CAD drawing which we were putting through OGR as part of our professional work. It contains one HATCH entity. The file is intended to be projected in a southern hemisphere UTM zone.
This HATCH is incorrectly converted to a MULTILINESTRING instead of a POLYGON, because the endpoint of one segment of the hatch boundary doesn't coincide closely enough with the endpoint of the next segment.
The DXF code uses a hard-coded tolerance of 0.0000001 (1e-7) which might be OK for lat/long coordinate systems, but is unreasonably small when working in grid-based coordinate systems in metres or feet.
The DXF driver seems to operate without knowledge of the spatial reference system, so my patch adds a new configuration parameter allowing the user to choose an appropriate hatch tolerance.
Attachments (4)
Change History (9)
by , 7 years ago
Attachment: | u-turn-hatch-UTM-55SNEW.dxf added |
---|
by , 7 years ago
Attachment: | u-turn-hatch-UTM-55S.png added |
---|
by , 7 years ago
Attachment: | OGR-DXF-hatch-tolerance.diff added |
---|
comment:1 by , 7 years ago
@atlight Your patch is reasonable, but I think it could be improved. For example what do you think about computing the bounding box of the coordinates of the geometry, taking the maximum of the absolute value of the x and y, and setting the default threshold to let's say 1e-8 of that value ? The configuration option could then override this default
comment:2 by , 7 years ago
Atlight, would you be willing to rework your patch with my above suggestion ?
comment:3 by , 7 years ago
@rouault I will do it when I have the time. If you feel that you will have time within the next two weeks or so, then of course you may take it on. I suppose it is not very difficult.
comment:4 by , 7 years ago
How about this?
I am still working out how to get the test suite working (Python is a mystery to me). Once I do that, my patches will have test cases incorporated in them instead of being separate files.
by , 7 years ago
Attachment: | OGR-DXF-hatch-tolerance-v2.diff added |
---|
Re-add accidentally omitted change to the doc html file
Patch