I download country cuts of OSM from GeoFabrik. When I import a country's PBF file into my PostGIS instance using ogr2ogr, it simply gives me a generically named set of tables (
Even if I rename the table, it does not change everything all the way down the database structure; so when I go to import a new country pbf file, it will give me:
ERROR 1: ERROR: relation "points_wkb_geometry_geom_idx" already exists
ogr2ogr command I'm using is:
ogr2ogr -f PostgreSQL PG:"dbname='dbname' host='host' port='5432' user='username' password='password'" country-latest.osm.pbf -lco COLUMN_TYPES=other_tags=hstore --config OSM_MAX_TMPFILE_SIZE 1024
I have also tried the following using the
ogr2ogr -f PostgreSQL PG:"dbname='dbname' host='host' port='5432' user='username' password='password'" country-latest.osm.pbf -nln "country_name_osm_date_" -lco COLUMN_TYPES=other_tags=hstore --config OSM_MAX_TMPFILE_SIZE 1024
But this results in:
Warning 1: Layer creation options ignored since an existing layer is being appended to.
Additionally it gives me geometric type mismatches, and failed copy statements, which makes sense, since
-nln I think is trying to write everything to one table, and a PBF file will yield multiple tables.
Doubtless this question has shown how bad my ogr2ogr-fu is. So, how can I designate a specific destination table name in the import statement to avoid future import conflicts?
osm2pgsql has the ability to use
--prefix argument as noted here: Define table name with osm2pgsql, however, I do not have
osm2pgsql available to me and would like to accomplish this with