Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#7017 closed defect (fixed)

Error in GDAL 2.2.1 reading FileGDB Polygon layers

Reported by: ianko Owned by: warmerdam
Priority: high Milestone: 2.2.2
Component: default Version: 2.2.1
Severity: critical Keywords: FileGDB, Polygons, Curves
Cc:

Description

Using FileGDB/ OpenFileGDB drivers produce errors on OsGeo.OGR.Layer.GetNextFeature if the input layer is of Polygon type and has geometries containing true arcs. Errors Description: OpenFileGDB - "Error occurred in e:\sdk\vc12x64\gdal-2.2\gdal\ogr\ogrsf_frmts\openfilegdb\filegdbtable.cpp" FileGDB - "Failed translating FGDB row [33] to OGR Feature (Operation successful.)"

Attachments (2)

sampleFGDB.gdb.zip (22.7 KB ) - added by ianko 7 years ago.
Sample FileGDB
sampleFGDB2.gdb.zip (23.5 KB ) - added by ianko 7 years ago.

Download all attachments as: .zip

Change History (16)

comment:1 by Even Rouault, 7 years ago

Please attach or provide a link to a dataset that show the issue

by ianko, 7 years ago

Attachment: sampleFGDB.gdb.zip added

Sample FileGDB

comment:2 by ianko, 7 years ago

File attached. Apparently the problem occurs only on PolygonZM. The same geometries with plain (no ZM) geometries go through. Straight segmented polygons, full circles, ellipses, Bezier curves are OK. A polygon containing straight segments and arc segments fail.

comment:3 by Even Rouault, 7 years ago

OK, I see the cause. The issue is that the last point of rings is not strictly identical to the first point: the X,Y,Z coordinates are the same, but the M value differ, so the ring is considered as not closed, in the parts of code that check it. Which is the case for shapes that have arc portions, whereas apparently we don't check closeness when shapes are just straight.

FID = 1
feature_offset = 1198
blob_len = 227
flags = [192]
geom_len = 181
geom_type = 15 --> 15
polygon zm
nb_total_points: 7
nb_geoms: 1
minx = 600427.246810181997716
miny = 7132480.778095460496843
maxx = 603464.808078794507310
maxy = 7134708.323025776073337
nb_points[0] = 7
[1] 601237.263148479163647 7134708.323025776073337
[2] 601352.979768234305084 7133348.652743635699153
[3] 603464.808078793808818 7133782.590067722834647
[4] 602683.720895435661077 7132480.778095460496843
[5] 600861.184134269133210 7132509.707250399515033
[6] 600427.246810181997716 7133637.944293026812375
[7] 601237.263148479163647 7134708.323025776073337

[1] z=9412.597218705563137
[2] z=9412.597218705563137
[3] z=9412.597218705563137
[4] z=9412.597218705563137
[5] z=9412.597218705563137
[6] z=9412.597218705563137
[7] z=9412.597218705563137

[1] m=0.000000000000000
[2] m=1364.585509311615397
[3] m=3520.535512098440449
[4] m=5038.696109377900029
[5] m=6861.462452552159448
[6] m=8070.271960122435303
[7] m=9412.597218705564956

cur_offset = 1386
Field ET_ID : 9
Field Shape_Length : 9412.597219
Field Shape_Area : 3048812.148015
Field ShapeType : "Linear Segments"
Field ReadStatus : "Passes"

[...]
FID = 5
feature_offset = 2502
blob_len = 211
flags = [192]
geom_len = 167
geom_type = 3758096435 --> 51
generalpolygon
 has z
 has m
 has curves
nb_total_points: 5
nb_geoms: 1
nb_curves: 1
minx = 602034.207894354127347
miny = 7124966.286125707440078
maxx = 604101.249487456283532
maxy = 7127302.459361349232495
nb_points[0] = 5
[1] 603667.312163368798792 7127302.459361349232495
[2] 604101.249487455934286 7125306.347670547664165
[3] 602057.457291204482317 7124966.286125707440078
[4] 602568.004275680519640 7126376.726403296925128
[5] 603667.312163368798792 7127302.459361349232495

[1] z=7122.591298987254049
[2] z=7122.591298987254049
[3] z=7122.591298987254049
[4] z=7122.591298987254049
[5] z=7122.591298987254049

[1] m=0.000000000000000
[2] m=2042.734315419066206
[3] m=4114.624369388498963
[4] m=5685.420696185366069
[5] m=7122.591298987254959

curves:
curve 0:
start_index = 2
curve_type = 1
 --> circular arc
d1 = 602123.767617
d2 = 7125739.906591
bits = 406
 IsMinor
 DefinedIP
Field ET_ID : 13
Field Shape_Length : 7122.591299
Field Shape_Area : 2856359.088541
Field ShapeType : "Streight + Arc"
Field ReadStatus : "Fails"

comment:4 by ianko, 7 years ago

It might be that, but this will prevent reading such data - any ZM polygons created in ArcGIS (and stored in FileGDB) that have Arc segments. Can't you just handle this?

by ianko, 7 years ago

Attachment: sampleFGDB2.gdb.zip added

comment:5 by ianko, 7 years ago

It appears that this is not the only reason. Attached is a second sample where all M values are NaN. The poilygons containing straight and Arc segments also fail on GetNextFeature.

comment:6 by Even Rouault, 7 years ago

In 39946:

OGRCurve::get_isClosed(): do not take into account M component (refs #7017)

comment:7 by Even Rouault, 7 years ago

In 39947:

OGRLineString::setPoint() and addPoint() with a OGRPoint* argument. properly takes into account ZM, Z and M dimensions (refs #7017)

comment:8 by Even Rouault, 7 years ago

In 39948:

OpenFileGDB: properly read GeneralPolygon with M component whose all values are set to NaN (refs #7017)

comment:9 by Even Rouault, 7 years ago

In 39949:

FileGDB/OpenFileGDB: add tests for polygons ZM with curve parts (refs #7017)

comment:10 by Even Rouault, 7 years ago

In 39950:

OGRCurve::get_isClosed(): do not take into account M component (refs #7017)

comment:11 by Even Rouault, 7 years ago

In 39951:

OGRLineString::setPoint() and addPoint() with a OGRPoint* argument. properly takes into account ZM, Z and M dimensions (refs #7017)

comment:12 by Even Rouault, 7 years ago

In 39952:

OpenFileGDB: properly read GeneralPolygon with M component whose all values are set to NaN (refs #7017)

comment:13 by Even Rouault, 7 years ago

Milestone: 2.2.2
Resolution: fixed
Status: newclosed

comment:14 by Even Rouault, 7 years ago

In 39953:

FileGDB/OpenFileGDB: commit data files (refs #7017)

Note: See TracTickets for help on using tickets.