Skip to content Skip to main navigation Skip to footer

How to connect to an external database?

In GIS Cloud, it is possible to connect an external database to GIS Cloud and manage data from the external database.  

Table of contents

Currently, PostGIS database has read and write permissions, while Oracle Spatial has only read permission.

PostGIS database

Since the PostGIS database has read and write permissions, there are numerous ways how you can import and manage data with your external database:

  • Import Shapefile or XLS/CSV table from GIS Cloud in an external database
  • Display a spatial table from an external database on the GIS Cloud map
  • Add, edit, delete features from tables stored in an external database
  • Delete table from an external database
  • Add, edit, delete attributes from tables stored in an external database
  • Connect Mobile Data Collection app and external database and collect data in an external database

Requirements to connect

GIS Cloud database connections are expected to be in the Simple Features SQL format as implemented by PostGIS version 1.5 or higher, including the following requirements:

  • The geometry columns should be named wkb_geometry
  • The primary key should be named ogc_fid. An auto-incrementing (or serial) column, as opposed to a regular numeric column, is used to ensure that each inserted row gets an automatically generated unique ID (FID) value.
  • The tables should have primary keys set so that they can be edited
  • All user tables and PostGIS tables need to have the relevant database permissions set so they can be read from and/or written to by the specified user
  • Password must be encrypted using MD5 encryption

Step-by-step instructions

To connect to PostGIS database, follow these steps:

  1. Open Tools tab
  2. Open Database Manager
  3. Click New

4. A new window will open. Choose PostgreSQL (PostGIS) from the dropdown list and fill in the parameters to connect to your external database and press Save.

Note: the values in the picture above serve as an example and are not the values you need to type to create your own database.

Values explanation:

  • Host – this is presumably your IP address. This has to be a public IP address, reachable from the Internet, not a private one (if your address is 10.x.y.z, 192.168.x.y, that won’t work).
  • Port – keep the default port 5432, unless you explicitly set up your database differently
  • Database name – this is the name of your database within PostgreSQL+PostGIS
  • Username – this is the name of the database user that can connect to the before-mentioned database. Note that this option is case-sensitive.
  • Password – This is the database password. Note that this option is case-sensitive.
  • SSL (Secure Socket Layer) – Set the desired level of connection security from the dropdown menu.
  • Scheme – By enabling this you choose to see only public schema tables.

Sync the data in the external PostGIS with GIS Cloud

If you edit your data in the external PostGIS database, the changes will be visible right away in the GIS Cloud data grid. However, in order for all the changes to be visible on the map as well, you should clear the map cache. There are 3 ways to do that:

  1. Clear map tiles manually in Map Properties. Learn how to do it in this guide.
  2. Using Javascript API.

    There are reset() methods available on both giscloud.maps and giscloud.layers.

    Use like this: giscloud.maps.reset(<mapId>, [<layer1 id>, <layer2 id>,…], <options>); The options can contain a ‘cascade’ property which, if set to true, will additionally reset all the other layers in any other maps which use the same source of data (e.g. the same database table). Learn more about this here.
  3. Using REST API. Find more information here.

Oracle database

Apart from the external PostGIS database, you can also connect your Oracle database with Map Editor and view the data from your Oracle database. At the moment, we offer a read-only solution, meaning you won’t be able to import or create new data nor edit the table structure and the existing attribute data directly from our app. However, you can visually represent your data on a map, access all the connected information as well as perform classifications and basic selections.

Follow these steps to connect to your external Oracle database:

  1. Open Tools tab
  2. Open Database Manager
  3. In the Database Connection section, click New
  1. A new window will open. From the dropdown list choose Oracle Spatial and fill in the parameters to connect to your external database and then press Save.

Note: Feel free to test your connection before saving the database parameters to make sure everything is in order. You can edit the database connection parameters afterward as well. 

Values explanation:

  • Host – this is presumably your IP address. This has to be a public IP address, reachable from the Internet, not a private one (if your address is 10.x.y.z, 192.168.x.y, that won’t work).
  • Port – keep the default port 1521, unless you explicitly set up your database differently.
  • Service name – or SID of your database.
  • Username – this is the name of the database user that can connect to the before-mentioned database. Note that this option is case sensitive.
  • Password – This is the database password. Note that this option is case sensitive.

Was This Article Helpful?