Opened 7 years ago
Closed 7 years ago
#6366 closed defect (fixed)
-lco GEOMETRY_NAME ignored when importing FileGDB (with not null constraint on geometry column) to PostGIS
Reported by: | saultdon | Owned by: | warmerdam |
---|---|---|---|
Priority: | normal | Milestone: | 2.0.3 |
Component: | OGR_SF | Version: | 2.0.0 |
Severity: | normal | Keywords: | pg |
Cc: |
Description
I rebuilt GDAL this morning from https://svn.osgeo.org/gdal/branches/2.0/gdal and I tried to update or replace existing table in a PostGIS database. I tried DROP CASCADE original table and copy a new table when -update didn't work but it ignores the -lco GEOMETRY_NAME=geom flag.
The datasource I have is a FileGDB and trying to insert a table into a PostgreSQL 9.5/PostGIS 2.2.1.
The command I'm using is:
ogr2ogr -gt 65536 -f PostgreSQL pg:"host=${host} dbname=${db} port=${port}" dgtl_road_atlas.gdb DGTL_ROAD_ATLAS_MPAR_SP -nln ${schema}.dra_mpar_sp -nlt PROMOTE_TO_MULTI -progress -lco GEOMETRY_NAME=geom -a_srs "EPSG:3005" -unsetFid
But the resultant GEOMETRY columns name is "geometry" - which is the name of the GEOMETRY column inside the source FileGDB.
ogrinfo -ro -so pg:"host=${host} dbname=${db} port=${port}" bcgov.dra_mpar_sp :( =98% INFO: Open of `pg:host=${host} dbname=${db} port=${port}' using driver `PostgreSQL' successful. Layer name: bcgov.dra_mpar_sp Geometry: Multi Line String Feature Count: 1723766 Extent: (336279.147717, 364282.200602) - (1874557.681717, 1717288.836602) Layer SRS WKT: PROJCS["NAD83 / BC Albers", 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"]], UNIT["metre",1, AUTHORITY["EPSG","9001"]], PROJECTION["Albers_Conic_Equal_Area"], PARAMETER["standard_parallel_1",50], PARAMETER["standard_parallel_2",58.5], PARAMETER["latitude_of_center",45], PARAMETER["longitude_of_center",-126], PARAMETER["false_easting",1000000], PARAMETER["false_northing",0], AUTHORITY["EPSG","3005"], AXIS["Easting",EAST], AXIS["Northing",NORTH]] FID Column = ogc_fid Geometry Column NOT NULL = geometry ...
So it looks like it could be using the geometry column name from the input data source because it's not falling back to the wkb_geometry default.
My data source is a 261 MB FileGDB from ftp://ftp.geobc.gov.bc.ca/sections/outgoing/bmgs/DRA_Public/dgtl_road_atlas.gdb.zip
Change History (3)
comment:1 by , 7 years ago
comment:2 by , 7 years ago
Summary: | -lco GEOMETRY_NAME ignored when importing FileGDB to PostGIS → -lco GEOMETRY_NAME ignored when importing FileGDB (with not null constraint on geometry column) to PostGIS |
---|
comment:3 by , 7 years ago
Component: | default → OGR_SF |
---|---|
Keywords: | pg added |
Milestone: | → 2.0.3 |
Resolution: | → fixed |
Status: | new → closed |
Version: | 2.0.2 → 2.0.0 |
It looks like this specific FileGDB is causing problems.
The geometry column is being created in PostGIS as:
Whereas other FileGDBs that I've tested are working as expected and being created as:
There is something different about the source datasets geometry column.
In the dgtl_road_atlas dataset (the one giving troubles) ogrinfo reports it as:
And one of the working FileGDB reports the goemetry column as: