Import Layer into Database
To perform editing or data analysis, the layers you’re working with must reside in the database.
To import file into the database:
- Click Tools tab and click Database Manager icon.
- Click Import Geospatial file icon.
- Select layer you want to import (or upload it to the GIS Cloud).
- Click Select button.
- Write table name.
Note: When naming table:
- start with a letter or an underscore (_)
- use only English alphabet letters, digits and underscores
- use only lower case
- Overwrite existing – Overwrites existing table with the same name
- Explode collections – Explodes multigeometry features to the geometry (i.e. multipolygons to polygons)
- Skip failures – Skips features that can’t be imported to the database
- Use shp2pgsql – Converts a shapefile into a series of SQL commands
- After choosing layer and defining options click Import button.
- Select Add Layer from the Layer tab or Map tab.
- Select Database from the dropdown menu.
- Select a table.
- Click Select button.
Note: make sure that layer has UTF-8 encoding.
Database is the required data source for editing geometry and performing any data editing, calculations, or analysis.
Database layer is added to a project as shown below:
Troubleshoot the errors while importing data into Database
Table name is not valid
This error indicates that name of the table is not valid. When naming a table, don’t use spaces or any special characters. Use only English alphabet letters, digits or an underscore (_). Use only lower case.
Unable to open, check if you uploaded all the neccesary files
Shapefile has a several mandatory files: .shp, .shx, .dbf and .prj. If some of them is missing, the layer won’t be imported in database. Upload all the mandatory files in File Manager and try again.
Invalid geometry, please try another type
This mesage indicated that system couldn’t recognize the layer’s geometry. Select an appropriate geometry type from the drop down list and try again. This error may appear when importing the multigeometry layers. If the layer is multigeomety (multipoint, multiline or multipolygon), select the coresponding geometry type and check ‘Explode collections’ checkbox.
Table already exists
This message indicates that a table with the same name already exists in the database. As there can’t be two tables with the same name in the database, delete or rename the table from the database or check ‘Overwrite existing’ checkbox and try again.