Opened 11 years ago

Closed 11 years ago

#3664 closed defect (fixed)

OGR SDTS driver problem with Polygons

Reported by: lwaugh Owned by: warmerdam
Priority: normal Milestone: 1.7.3
Component: OGR_SF Version: 1.7.1
Severity: normal Keywords: sdts
Cc:

Description

I have found (and fixed) a problem with SDTS polygons.

Firstly the problem: When the features are accessed for the first polygon layer in a datasource the rings are correct, however, when subsequent polygon layers are accessed the rings are duplicated. Thereby causing inner rings to match outer rings on some features. This can be replicated using "ogrinfo -ro {CATD} PC02" compared with "ogrinfo -ro {CATD} PC01 PC02" - and checking the PC02 features will show duplicated rings.

The cause: The AssembleRings? function is called when attempting to retrieve features for a polygon layer and it builds the polygons by reading through the Line layers and Attaching them to the Polygons (using AttachToPolygons?). While AssembleRings? ensures it is only run once per PolygonReader? (using bRingsAssembled flag) and each PolygonReader? is owned by a layer. The called function AttachToPolygons? attaches all line segments to ALL layers. Therefore causing the duplication of rings when a subsequent polygon layer is accessed.

The fix:

sdtslinereader.cpp: Change AttachToPolygons? to limit attachments ONLY to requested layer (new parameter). Easily done with "if (iPolyLayer != iLayer) continue" at (or near) Line 320

sdtspolygonreader.cpp: Change AssembleRings? to pass through the requested layer (new parameter), and the call to AttachToPolygons?.

sdts_al.h: Change definitions of AssembleRings? and AttachToPolygons? to have int iLayer parameter.

ogrsdtslayer.cpp: Change call to AssembleRings? to have the new parameter iLayer.

sdts2shp.cpp: Change call to AssembleRings? to have the new parameter iLayer.

Attachments (1)

1420067.HY.sdts.zip (246.6 KB) - added by lwaugh 11 years ago.
An example SDTS from USGS

Download all attachments as: .zip

Change History (4)

Changed 11 years ago by lwaugh

Attachment: 1420067.HY.sdts.zip added

An example SDTS from USGS

comment:1 Changed 11 years ago by warmerdam

Keywords: sdts added
Status: newassigned

comment:2 Changed 11 years ago by warmerdam

Problem confirmed in trunk.

comment:3 Changed 11 years ago by warmerdam

Milestone: 1.7.3
Resolution: fixed
Status: assignedclosed

Suggested fix applied in trunk (r19952), 1.7 branch (r19953) and 1.6 branch (r19954).

Thanks!

Unfortunately, I don't have a small test dataset with multiple polygon modules, so there is currently no regression test on this issue.

Note: See TracTickets for help on using tickets.