...
Page Properties |
---|
|
Theme | Data Manipulation |
---|
Type | QGIS |
---|
Available from | |
|
---|
|
Say you have some spatial data in QGIS and you want to load it into PostgreSQL. You can make use of the QGIS DB Manager tool to transfer data. The tool will create the necessary constraints and spatial indexes for further consumption in iShare applications.
Step-by-step guide
Using the DB Manager
- In QGIS make sure that you have a PostGIS connection to your PostgreSQL/PostGIS database. Click the blue elephant icon (Add PostGIS Layers) and explore the available connections.
- If QGIS doesn't have your database listed click 'New Connection...' and enter the details making sure to test the connection before continuing.
- Select from the Database menu select DB Manager > DB Manager
- Highlight the destination Postgresql database and click the Import Layer File button.
- Fill in the necessary details.
Select the Input file, destination Schema and Table name.
Set primary key as 'ogc_fid', geometry column as 'wkb_geometry', and the correct Source SRID and Target SRID projection and choose Create spatial index.
You can also chose to Replace destination table (if exists) to overwrite an existing table and choose the correct Encoding. Shapefile and Mapinfo Tab files can sometimes be stored in Latin-1 but often the default UTF-8 character set will be fine.
Press OK to import.
- Import has been successful. If not the problem might be character set encoding, invalid geometries or a precision difference. PostGIS supports geometry nodes with 11 decimal place precision. Source data may be more precise. Please see alternative way of Importing Using the Processing Toolbox.
Using the Processing Toolbox...