To change the name of the destination geometry column, use -lco GEOMETRY_NAME=geom
. By default, the geometry column is named wkb_geometry
. See docs.
To set the destination schema, there are a few ways to do it according to the PostGIS driver documentation.
1) Specify the destination table prefixed with the schema with -nln your_schema.yourfeatureclass
:
ogr2ogr -f "PostgreSQL" PG:"host=localhost port=5432 user=user dbname=db password=pw" "FileGDB.gdb" "yourfeatureclass" -lco GEOMETRY_NAME=geom -nln your_schema.yourfeatureclass
2) Add schemas=schema1,schema2
or active_schema=schema1
in the connection string (active_schema
gives a warning but works with my version - 2.2.1 on Windows, so using schemas
is preferred):
ogr2ogr -f "PostgreSQL" PG:"host=localhost port=5432 user=user dbname=db password=pw active_schema=your_schema" "FileGDB.gdb" "yourfeatureclass" -lco GEOMETRY_NAME=geom
or
ogr2ogr -f "PostgreSQL" PG:"host=localhost port=5432 user=user dbname=db password=pw schemas=your_schema" "FileGDB.gdb" "yourfeatureclass" -lco GEOMETRY_NAME=geom
3) Add the schema in an option -lco SCHEMA=your_schema
ogr2ogr -f "PostgreSQL" PG:"host=localhost port=5432 user=user dbname=db password=pw" "FileGDB.gdb" "yourfeatureclass" -lco GEOMETRY_NAME=geom -lco SCHEMA=your_schema
Warning: #3 does not work if there is a table with the same name in the public schema.
-lco GEOMETRY_NAME=geom
to set the name of the geometry column to "geom" and prefix your destination table name with your schema name like that:-nln your_schema.your_table