This article briefly records how to import and export common data involved in PostGIS. Here you need to pay attention to a few parameters, whether to choose-c or-a depends on your application method,-S is in
This article briefly records how to import and export common data involved in PostGIS. Here you need to pay attention to a few parameters, whether to choose-c or-a depends on your application method,-S is in
This article briefly records how to import and export common data involved in PostGIS.
1. Import osm data to PostGIS
Osm2pgsql-c-d osm-l-E 4326-S/usr/share/osm2pgsql/default. style xxxxx. osm
Here, pay attention to a few parameters. Whether to choose-c or-a depends on your application method.-S is not used in the path of Ubuntu, and espg can no longer use 900913. Naturally, it is best to make the database adopt UTF8 encoding.
Osm2pgsql SVN version 0.70.5
Usage:
Osm2pgsql [options] planet. osm
Osm2pgsql [options] planet. osm. {gz, bz2}
Osm2pgsql [options] file1.osm file2.osm file3.osm
This will import the data from the OSM file (s) into a PostgreSQL database
Suitable for use by the Mapnik renderer
Options:
-A | -- append Add the OSM file into the database without removing
Existing data.
-B | -- bbox Apply a bounding box filter on the imported data
Must be specified as: minlon, minlat, maxlon, maxlat
E.g. -- bbox-0.5, 51.25, 0.5, 51.75
-C | -- create Remove existing data from the database. This is
Default if -- append is not specified.
-D | -- database The name of the PostgreSQL database to connect
To (default: gis ).
-I | -- tablespace-index The name of the PostgreSQL tablespace where indexes will be create
To (default: pg_default ).
-L | -- latlong Store data in degrees of latitude & longpolling.
-M | -- merc Store data in proper spherical mercator (default)
-M | -- oldmerc Store data in the legacy OSM mercator format
-E | -- proj num Use projection EPSG: num
-U | -- utf8-sanitize Repair bad UTF8 input data (present in planet
Dumps prior to August 2007). Adds about 10% overhead.
-P | -- prefix Prefix for table names (default planet_osm)
-S | -- slim Store temporary data in the database. This greatly
Reduces the RAM usage but is much slower.
-S | -- style Location of the style file. Defaults to/usr/share/default. style
-C | -- cache Only for slim mode: Use upto this memory MB for caching nodes
Default is 800
-U | -- username Postgresql user name.
-W | -- password Force password prompt.
-H | -- host Database server hostname or socket location.
-P | -- port Database server port.
-E | -- expire-tiles [min_zoom-] max_zoom Create a tile expiry list.
-O | -- expire-output filename Output filename for expired tiles list.
-R | -- input-reader Input frontend.
Libxml2-Parse XML using libxml2. (default)
Primitive-Primitive XML parsing.
-O | -- output Output backend.
Pgsql-Output to a PostGIS database. (default)
Gazetteer-Output to a PostGIS database suitable for gazetteer
Null-No output. Useful for testing.
-X | -- extra-attributes
Include attributes for each object in the database.
This parameter des the username, userid, timestamp and version.
Note: this option also requires additional entries in your style file.
-K | -- hstore Generate an additional hstore (key/value) column to postgresql tables
-Z | -- hstore-column Generate an additional hstore (key/value) column to containing all tags
That start with the specified string, eg -- hstore-column "name:" will
Produce an extra hstore column that contains all name: xx tags
-G | -- multi-geometry Generate multi-geometry features in postgresql tables.
-K | -- keep-coastlines Keep coastline data rather than filtering it out.
By default natural = coastline tagged data will be discarded based on
Assumption that post-processed Coastline Checker shapefiles will be used.
-H | -- help Help information.
-V | -- verbose Verbose output.
Add-v to display supported projections.
Use-E to access any espg projections (usually in/usr/share/proj/epsg)
,