I am using ogr2ogr to import geojson files into a PostGIS table. The table has two geography columns ("footprint" and "centroid"). The geojson files contain polygon features, and I wish to import these into the footprint column. All other columns have useful defaults or are nullable.
Unfortunately when I do this, the footprint geography is always imported as NULL.
If I remove the centroid column (so I only have one geography column) it works perfectly with something like:
ogr2ogr -nln spatial.buildings -update -append -gt 65536 -f "PostgreSQL" PG:"<my connection string>" "RhodeIsland.geojson"
Using ogrinfo I was able to find that the geography was being imported as ogr_geometry
. So I tried renaming it using the SQL parameter:
ogr2ogr -nln spatial.buildings -update -append -gt 65536 -sql "SELECT ogr_geometry AS footprint FROM RhodeIsland" -f "PostgreSQL" PG:"<my connection info" "RhodeIsland.geojson"
But this doesn't work either. (as an aside, the sql parameter could prove useful to do a better job with the other fields)
Does ogr2ogr Postgres import support tables with multiple geography columns and, if so, how do I specify them?
Note: I'm appending data to the table. This is NOT a new table.
ogr_geometry
orgeometry
. See answer gis.stackexchange.com/a/296749/638 to understand the difference