Skip to content
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

Closed
JustinP31 opened this issue Jun 20, 2023 · 3 comments
Assignees

Comments

@JustinP31
Copy link

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

Loading with FileGDB driver:
2023-06-16_16-29-24

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

@jratike80
Copy link
Collaborator

jratike80 commented Jun 20, 2023

Is the gdb file created with some ESRI product?
I can confirm that GDAL 3.8.0dev finds geometries
POINT (1.84422404740822E+15 1.84422404740822E+15) from the point1 layer.

ArcGIS Pro opens all the layers so that the geometries are empty.

@JustinP31
Copy link
Author

Is the gdb file created with some ESRI product?

Yes, ArcMap 10.6.1

@rouault rouault self-assigned this Jun 21, 2023
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
@rouault
Copy link
Member

rouault commented 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
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants