Import and export of common spatial data in PostGIS

Source: Internet
Author: User
Tags in degrees postgis

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)

  • 1
  • 2
  • Next Page

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.