-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
OpenFileGDB driver possibly assigning geometry to points when they should be NULL/EMPTY #7986
Comments
Is the gdb file created with some ESRI product? ArcGIS Pro opens all the layers so that the geometries are empty. |
Yes, ArcMap 10.6.1 |
rouault
added a commit
to rouault/gdal
that referenced
this issue
Jun 21, 2023
rouault
added a commit
to rouault/gdal
that referenced
this issue
Jun 21, 2023
fix in #7989 |
rouault
added a commit
that referenced
this issue
Jun 24, 2023
OpenFileGDB: correctly read POINT EMPTY (fixes #7986)
rouault
added a commit
to rouault/gdal
that referenced
this issue
Jun 24, 2023
rouault
added a commit
to rouault/gdal
that referenced
this issue
Jun 24, 2023
rouault
added a commit
that referenced
this issue
Jun 25, 2023
[Backport 3.7] OpenFileGDB: correctly read POINT EMPTY (fixes #7986)
jeffypooo
pushed a commit
to IgnisTechnologies/gdal
that referenced
this issue
Aug 9, 2023
jeffypooo
pushed a commit
to IgnisTechnologies/gdal
that referenced
this issue
Aug 9, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Expected behavior and actual behavior.
I expected to import this GDB SourceData_Copy.gdb.zip into Postgres using this ogr2ogr command
ogr2ogr -f PostgreSQL "PG:host='127.0.0.1' user='pguser' password='pguser' dbname='test_db' port='5432'" -lco SCHEMA=source1 -lco OVERWRITE=YES -preserve_fid --config PG_USE_COPY YES "/path/to/gdb/file/SourceData_Copy.gdb" -nlt GEOMETRY
where there are Points that contain NULL/EMPTY geometry, however what I'm seeing is the Points are getting assigned geometry. According to ESRI's check geometry tool these Points should be NULL.
Interestingly, It seems the FileGDB driver imports the NULL geometry for Points as expected but doesn't like Polygon geometry that contains NULL geometry (see error below). Whereas the OpenFileGDB driver will handle the NULL geometry for Polygons and Lines as expected but will assign Points geometry when they should be NULL/EMPTY.
The dataset includes layers of these geometry types: Points, Multi Polygon, and Multi Line String all containing NULL geometry.
Loading with OpenFileGDB driver:
![2023-06-16_16-26-50](https://private-user-images.githubusercontent.com/55069506/247237406-f5e61ed1-0bd7-47c5-b96e-55ea413dc26a.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzg4MzIwNjYsIm5iZiI6MTczODgzMTc2NiwicGF0aCI6Ii81NTA2OTUwNi8yNDcyMzc0MDYtZjVlNjFlZDEtMGJkNy00N2M1LWI5NmUtNTVlYTQxM2RjMjZhLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMDYlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjA2VDA4NDkyNlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTA0MGZjNDFkODczODc5MmVjM2FhYjVkOWIxMDFjMmIwNzMwYjJmZmU5MjVjYTQ1MTlmNTY1YTE5MDIwZWY1ZmImWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.8ffpfB5yWk5C4wJzSk6SqOLFeDawG2dGBOpLU_p5yDk)
Loading with FileGDB driver:
![2023-06-16_16-29-24](https://private-user-images.githubusercontent.com/55069506/247237463-8f1e5e07-1bb1-4cfb-a6a7-4d95461fc6be.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzg4MzIwNjYsIm5iZiI6MTczODgzMTc2NiwicGF0aCI6Ii81NTA2OTUwNi8yNDcyMzc0NjMtOGYxZTVlMDctMWJiMS00Y2ZiLWE2YTctNGQ5NTQ2MWZjNmJlLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMDYlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjA2VDA4NDkyNlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTBiZDNjOTgyNTUxYTZmYmZkYTkwMDA3NDc2YTViYmQwODVjM2Y4MGZjNDJlMWNmNzc2NDRhNzJlMDViYTFkNTMmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.X-3ohIG34apJqXD7W7MBn8XRPxnhWwJZKkVq2w1-eoE)
Error when loading Polygons with NULL geometry:
ERROR 1: Failed attempting to import GDB WKB Geometry. OGRGeometryFactory err:6
ERROR 1: Failed to translate FileGDB Geometry to OGR Geometry for row 6 (Operation successful.)
ERROR 1: Failed translating FGDB row [6] to OGR Feature (Operation successful.)
ERROR 1: Failed attempting to import GDB WKB Geometry. OGRGeometryFactory err:6
ERROR 1: Failed to translate FileGDB Geometry to OGR Geometry for row 7 (Operation successful.)
ERROR 1: Failed translating FGDB row [7] to OGR Feature (Operation successful.)
ERROR 1: Failed attempting to import GDB WKB Geometry. OGRGeometryFactory err:6
ERROR 1: Failed to translate FileGDB Geometry to OGR Geometry for row 8 (Operation successful.)
ERROR 1: Failed translating FGDB row [8] to OGR Feature (Operation successful.)
Even simply running these ogrinfo commands shows the same problem:
ogrinfo '/path/to/gdb/file/SourceData_Copy.gdb' Point1 --config OGR_SKIP FileGDB
OUTPUT:
Had to open data source read-only.
INFO: Open of /path/to/gdb/file/SourceData_Copy.gdb'
using driver OpenFileGDB' successful.
Layer name: Point1
Geometry: Point
Feature Count: 3
Extent: (6269037.630127, 1830269.087524) - (6373065.141907, 1943449.610474)
Layer SRS WKT:
PROJCS["NAD83 / California zone 6 (ftUS)",
GEOGCS["NAD83",
DATUM["North_American_Datum_1983",
SPHEROID["GRS 1980",6378137,298.257222101,
AUTHORITY["EPSG","7019"]],
TOWGS84[0,0,0,0,0,0,0],
AUTHORITY["EPSG","6269"]],
PRIMEM["Greenwich",0,
AUTHORITY["EPSG","8901"]],
UNIT["degree",0.0174532925199433,
AUTHORITY["EPSG","9122"]],
AUTHORITY["EPSG","4269"]],
PROJECTION["Lambert_Conformal_Conic_2SP"],
PARAMETER["standard_parallel_1",33.88333333333333],
PARAMETER["standard_parallel_2",32.78333333333333],
PARAMETER["latitude_of_origin",32.16666666666666],
PARAMETER["central_meridian",-116.25],
PARAMETER["false_easting",6561666.667],
PARAMETER["false_northing",1640416.667],
UNIT["US survey foot",0.3048006096012192,
AUTHORITY["EPSG","9003"]],
AXIS["X",EAST],
AXIS["Y",NORTH],
AUTHORITY["EPSG","2230"]]
FID Column = OBJECTID
Geometry Column = SHAPE
FULLNAME: String (125.0)
Comment: String (75.0)
OGRFeature(Point1):57925
FULLNAME (String) = EMPTY GEOM
Comment (String) = (null)
POINT (1.84422404740822e+15 1.84422404740822e+15)
OGRFeature(Point1):57926
FULLNAME (String) = EMPTY GEOM
Comment (String) = (null)
POINT (1.84422404740822e+15 1.84422404740822e+15)
OGRFeature(Point1):57927
FULLNAME (String) = EMPTY GEOM
Comment (String) = (null)
POINT (1.84422404740822e+15 1.84422404740822e+15)
ogrinfo '/path/to/gdb/file/SourceData_Copy.gdb' Point1 --config OGR_SKIP OpenFileGDB
OUTPUT:
INFO: Open of /path/to/gdb/file/SourceData_Copy.gdb'
using driver FileGDB' successful.
Layer name: Point1
Geometry: Point
Feature Count: 3
Extent: (6269037.630127, 1830269.087524) - (6373065.141907, 1943449.610474)
Layer SRS WKT:
PROJCS["NAD83 / California zone 6 (ftUS)",
GEOGCS["NAD83",
DATUM["North_American_Datum_1983",
SPHEROID["GRS 1980",6378137,298.257222101,
AUTHORITY["EPSG","7019"]],
TOWGS84[0,0,0,0,0,0,0],
AUTHORITY["EPSG","6269"]],
PRIMEM["Greenwich",0,
AUTHORITY["EPSG","8901"]],
UNIT["degree",0.0174532925199433,
AUTHORITY["EPSG","9122"]],
AUTHORITY["EPSG","4269"]],
PROJECTION["Lambert_Conformal_Conic_2SP"],
PARAMETER["standard_parallel_1",33.88333333333333],
PARAMETER["standard_parallel_2",32.78333333333333],
PARAMETER["latitude_of_origin",32.16666666666666],
PARAMETER["central_meridian",-116.25],
PARAMETER["false_easting",6561666.667],
PARAMETER["false_northing",1640416.667],
UNIT["US survey foot",0.3048006096012192,
AUTHORITY["EPSG","9003"]],
AXIS["X",EAST],
AXIS["Y",NORTH],
AUTHORITY["EPSG","2230"]]
FID Column = OBJECTID
Geometry Column = SHAPE
FULLNAME: String (125.0)
Comment: String (75.0)
OGRFeature(Point1):57925
FULLNAME (String) = EMPTY GEOM
Comment (String) = (null)
POINT (nan nan)
OGRFeature(Point1):57926
FULLNAME (String) = EMPTY GEOM
Comment (String) = (null)
POINT (nan nan)
OGRFeature(Point1):57927
FULLNAME (String) = EMPTY GEOM
Comment (String) = (null)
POINT (nan nan)
Steps to reproduce the problem.
OGR2OGR (look in postgres afterwards)
Using FileGDB driver:
ogr2ogr -f PostgreSQL "PG:host='127.0.0.1' user='pguser' password='pguser' dbname='test_db' port='5432'" -lco SCHEMA=source1 -lco OVERWRITE=YES -preserve_fid --config PG_USE_COPY YES "/path/to/gdb/file/SourceData_Copy.gdb" -nlt GEOMETRY --config OGR_SKIP OpenFileGDB
Using OpenFileGDB driver:
ogr2ogr -f PostgreSQL "PG:host='127.0.0.1' user='pguser' password='pguser' dbname='test_db' port='5432'" -lco SCHEMA=source1 -lco OVERWRITE=YES -preserve_fid --config PG_USE_COPY YES "/path/to/gdb/file/SourceData_Copy.gdb" -nlt GEOMETRY
OGRINFO
Using OpenFileGDB:
ogrinfo '/path/to/gdb/file/SourceData_Copy.gdb' Point1 --config OGR_SKIP FileGDB
Using FileGDB:
ogrinfo '/path/to/gdb/file/SourceData_Copy.gdb' Point1 --config OGR_SKIP OpenFileGDB
Operating system
Ubuntu 18.04
Postgres 11
Postgis 3.3
GDAL version and provenance
Tested with GDAL 2.2.3 and GDAL 3.6.3
The text was updated successfully, but these errors were encountered: