I'm attempting to load a file gdb to an alternate postgresql database schema. The process works OK with the following but uploads to the public schema.
ogr2ogr -f "PostgreSQL" PG:"host=localhost port=5432 dbname=GIS user=postgres password=xxxxxx" "C:\test.gdb
Can anyone assist?
2 Answers 2
You can add into your connection string the option ACTIVE_SCHEMA=your_schema
ogr2ogr -f "PostgreSQL" PG:"host=localhost port=5432 dbname=GIS user=postgres password=xxxxxx ACTIVE_SCHEMA=your_schema" "C:\test.gdb
All other options can be found in the driver documentation: http://www.gdal.org/drv_pg.html
Reading the manual page http://www.gdal.org/drv_pg.html makes me think that you must add a layer creation option "schema" or dataset open option "active_schema".
Layer creation options
SCHEMA: Set name of schema for new table. Using the same layer name in different schemas is supported, but not in the public schema and others. Note that using the -overwrite option of ogr2ogr and -lco SCHEMA= option at the same time will not work, as the ogr2ogr utility will not understand that the existing layer must be destroyed in the specified schema. Use the -nln option of ogr2ogr instead, or better the active_schema connection string. See below example.
Dataset open options
ACTIVE_SCHEMA=string: Active schema
I would have a try with these commands:
ogr2ogr -f "PostgreSQL" PG:"host=localhost port=5432 dbname=GIS user=postgres password=xxxxxx" "C:\test.gdb -lco schema=my_schema
ogr2ogr -f "PostgreSQL" PG:"host=localhost port=5432 dbname=GIS user=postgres password=xxxxxx" "C:\test.gdb -doo ACTIVE_SCHEMA=my_schema
Explore related questions
See similar questions with these tags.