Wednesday 18 December 2019

postgis - Define table name with osm2pgsql



When I load OpenStreetMap data to PostGIS using osm2pgsql the resulting tables look like this:


+----------+--------------------+--------+---------+
| Schema | Name | Type | Owner |
|----------+--------------------+--------+---------|
| public | planet_osm_line | table | user |
| public | planet_osm_nodes | table | user |
| public | planet_osm_point | table | user |
| public | planet_osm_polygon | table | user |
| public | planet_osm_rels | table | user |
| public | planet_osm_roads | table | user |

| public | planet_osm_ways | table | user |
| public | spatial_ref_sys | table | user |
+----------+--------------------+--------+---------+

I do not like that the table names start with planet. Is it possible to define how the tables should be named?



Answer



You can change the planet part by anything you want using the command line argument --prefix The following command will create tables such as abc_osm_line


osm2pgsql.exe source.osm.pbf --prefix abc [...other parameters as needed..]

No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...