Opened 13 years ago

Closed 13 years ago

Last modified 13 years ago

#4224 closed defect (fixed)

[PATCH] FileGDB opening error: Invalid function arguments

Reported by: peifer Owned by: warmerdam
Priority: normal Milestone: 1.9.0
Component: OGR_SF Version: svn-trunk
Severity: normal Keywords: FileGDB
Cc: pramsey

Description

I guess the backslash could be an issue. The actual layer name is cha06. sample_clcV15_esri_v10.gdb is attached

$ ogrinfo -al -so sample_clcV15_esri_v10.gdb
ERROR 1: Error: Error opening \cha06 (Invalid function arguments.)
ERROR 1: Error: Error opening \cha06 (Invalid function arguments.)

Attachments (4)

sample_clcV15_esri_v10.gdb.zip (112.4 KB ) - added by peifer 13 years ago.
Sample FileGDB
ticket_4224.patch (775 bytes ) - added by Even Rouault 13 years ago.
sample_clcV13_esri_v10.gdb.zip (41.7 KB ) - added by peifer 13 years ago.
Another sample FileGDB
sample_clcV15_esri_v10_r2.gdb.zip (115.4 KB ) - added by peifer 13 years ago.
Sample FileGDB where CRS information of all layers has been "fixed"

Download all attachments as: .zip

Change History (14)

by peifer, 13 years ago

Sample FileGDB

comment:1 by peifer, 13 years ago

Component: defaultOGR_SF
Version: unspecifiedsvn-trunk

comment:2 by Even Rouault, 13 years ago

Cc: pramsey added

by Even Rouault, 13 years ago

Attachment: ticket_4224.patch added

comment:3 by Even Rouault, 13 years ago

Keywords: FileGDB added
Summary: FileGDB opening error: Invalid function arguments[PATCH] FileGDB opening error: Invalid function arguments

I've attached a patch that avoids erroring out when FGDB doesn't manage to open a layer and that just goes on the following layers. For your dataset, the \cha06 and \clc90 layers are skipped.

Wouldn't harm to apply, but it might be good to know why those layers cannot be opened. Are they valid layers or is it just a limitation of the SDK that cannot open it ?

comment:4 by peifer, 13 years ago

As GDAL user and without any knowledge about the inner workings of a FileGDB, I wouldn't know why these layers should be different than others. The only hint I can give is that the original FileGDB came to us in ArcGIS-pre-10 format, which we opened and saved with ArcGIS 10, in order to have real-life test material for GDAL's new FileGDB driver.

I assume the leading backslash in the layer name is some sort of Window-ish representation of the root level, as the actual layer names should be 'cha06' and 'clc90'.

comment:5 by peifer, 13 years ago

Thanks for the patch which works as expected. I attach another sample FileGDB, which is based on an earlier version of the same GIS dataset. For this one, ogrinfo reports 4 errors and a layer count of only: 1

$ ogrinfo -al -so -ro sample_clcV13_esri_v10.gdb

FGDB: Error opening \cha06
FGDB: Error opening \clc00
FGDB: Error opening \clc06
FGDB: Error opening \clc90

OGR: OGROpen(sample_clcV13_esri_v10.gdb/0x237df90) succeeded as FileGDB.
INFO: Open of `sample_clcV13_esri_v10.gdb'
      using driver `FileGDB' successful.
OGR: GetLayerCount() = 1

Layer name: cha00
Geometry: Multi Polygon
Feature Count: 1
...

by peifer, 13 years ago

Another sample FileGDB

comment:6 by peifer, 13 years ago

It looks that some spatial reference problems can cause the "Invalid function arguments" error, see this post on the ArcGIS forum:

http://forums.arcgis.com/threads/36745-File-Geodatabase-API-1.1-now-available?p=127473&viewfull=1#post127473

comment:7 by Even Rouault, 13 years ago

Milestone: 1.9.0
Resolution: fixed
Status: newclosed

ok, I've just applied a variation of the patch, since it seems to be an issue with the SDK and not the driver. Not much we can do if the SDK refuses to open tables...

r23025 /trunk/gdal/ogr/ogrsf_frmts/filegdb/ (FGdbDatasource.cpp FGdbUtils.cpp FGdbUtils.h): FGDB: skip tables that the SDK don't want to open (#4224)

comment:8 by peifer, 13 years ago

I can confirm that, as suggested in the ArcGIS FileGDB API Forum, the error is related to the CRS information of the individual layers. In principle, the CRS in all layers is defined to be ETRS89/LAEA (aka EPSG:3035). However, there are subtle differences in the CRS information, so that ArcGIS considers some layers to have a "customised" CRS, whereas others are exactly following the built-in definition of EPSG:3035. Layers with a "customised" CRS generate the "Invalid function arguments" error. After changing the FileGDB layers to any random CRS from the built-in CRS list, the error goes away:

$ ogrinfo sample_clcV15_esri_v10_r2.gdb
OGR: OGROpen(sample_clcV15_esri_v10_r2.gdb/0x8acf30) succeeded as FileGDB.
INFO: Open of `sample_clcV15_esri_v10_r2.gdb'
      using driver `FileGDB' successful.
OGR: GetLayerCount() = 5

1: cha06 (Multi Polygon)
2: clc00 (Multi Polygon)
3: clc06 (Multi Polygon)
4: clc90 (Multi Polygon)
5: cha00 (Multi Polygon)

by peifer, 13 years ago

Sample FileGDB where CRS information of all layers has been "fixed"

comment:9 by pramsey, 13 years ago

What are the "subtle differences" in the CRS you are referring to? All the SRS information we are handing to the FGDB API has been through the OGRSRS morphToEsri routine, so perhaps you've turned up a place where a minor improvement in that routine would help?

in reply to:  9 comment:10 by peifer, 13 years ago

Replying to pramsey:

In the given case, I was only reading from the FGDB through the API, not handing any SRS information to the FGDB API, which I would never dare to do. I only want to read the features, get them out of the FDGB, store them in a convenient format and forget about the source data file.

About the subtle differences, you might want to read this page: http://home.gdal.org/projects/opengis/wktproblems.html. The classic mismatch example for ETRS89/LAEA (EPSG:3035) are the parameter names: PARAMETER["Central_Meridian",10.0] (ESRI) versus PARAMETER["longitude_of_center",10] (GDAL). There are more pitfalls...

Note: See TracTickets for help on using tickets.