<a id="ngcom-data-connect"></a>

# How to connect data from external sources

[Web GIS](description.html.md#ngcom-description) supports connection of basemaps ([TMS](../../glossary.html.md#term-TMS) services) from external servers, vector geodata from external [PostGIS](../../glossary.html.md#term-PostGIS) databases and connection of vector and raster geodata from external [WMS](../../glossary.html.md#term-WMS) services.

<a id="ngcom-basemap-layer"></a>

## Basemaps

### Add a Basemap resource

1. Navigate to a Resource group where you want to create a basemap resource (by default, from the main page of Web GIS you access the Main resource group);
2. Press **Create resource** and select **Basemap**;
3. In the opened dialog, go to Resource tab and type a name for the new basemap in the field Display name. Then in Basemap tab fill in the field URL (if you know the correct link to [TMS](../../glossary.html.md#term-TMS) service) or start typing the name of the basemap in the field Search. If this basemap is found in [QuickMapServices](https://qms.nextgis.com/) catalog, the URL field will be filled in automatically and option “Use options from QMS” will be activated;
4. Press **Create** button. If Basemap is created successfully, you’ll see its name in Child resources pane of the relevant Resource group.

#### NOTE
We recommend creating a separate “Basemaps” Resource group to keep the basemaps to add your [Web maps](webmap_create.html.md#ngcom-webmap-create).

Find out how to add basemaps you’ve created to the Web map [here](webmap_create.html.md#ngcom-webmap-create).

<a id="ngcom-postgis-connect"></a>

## External PostGIS databases

<a id="ngcom-postgis-connection"></a>

### Create a PostGIS connection

1. Open Resource group where you want to create a connection (by default, from the main page of Web GIS you access the Main resource group);
2. Press **Create resource** and select **PostGIS connection**;
3. In the opened dialog, go to Resource tab and type a name for the new connection in the field Display name. Then in PostGIS connection tab fill in the fields Host, Database, User (if applicable) and Password (if applicable);
4. Press **Create** button. If PostGIS connection is created successfully, you’ll see its name in Child resources pane of the relevant Resource group.

<a id="ngcom-postgis-layer"></a>

### Create a PostGIS layer

1. Open Resource group where you want to create a data layer (by default, from the main page of Web GIS you access the Main resource group);
2. Press **Create resource** and select **PostGIS layer**;
3. In the opened dialog, go to Resource tab and type a name for the new layer in the field Display name. Then in PostGIS layer tab select [PostGIS connection](#ngcom-postgis-connection) and fill in the fields Schema, Table, ID column and Geometry column;
4. Press **Create** button. If PostGIS layer is created successfully, you’ll see its name in Child resources pane of the relevant Resource group.

Read more about connecting to external PostGIS databases here.

If you plan to display PostGIS layer on [Web map](webmap_create.html.md#ngcom-webmap-create) or publish it using [WMS](../../glossary.html.md#term-WMS) protocol, you need to create a [Style](styles.html.md#ngcom-styles) for it.

<a id="ngcom-wms-connect"></a>

## External WMS services

#### NOTE
Currently supported WMS versions 1.1.1 and 1.3.0.

<a id="ngcom-wms-connection"></a>

### Create a WMS connection

1. Open Resource group where you want to create a connection (by default, from the main page of Web GIS you access the Main resource group);
2. Press **Create resource** and select **WMS connection**;
3. In the opened dialog, go to Resource tab and type a name for the new connection in the field Display name. Then in WMS connection tab fill in the fields URL, Username (if applicable) and Password (if applicable) to connect to [WMS](../../glossary.html.md#term-WMS) server;
4. Press **Create** button. If WMS connection is created successfully, you’ll see its name in Child resources pane of the relevant Resource group.

#### WARNING
WMS server to which you connect must support EPSG:3857 [coordinate system](../../glossary.html.md#term-coordinate-system).

<a id="ngcom-wms-layer"></a>

### Create a WMS layer

1. Open Resource group where you want to create a data layer (by default, from the main page of Web GIS you access the Main resource group);
2. Press **Create resource** and select **WMS layer**;
3. In the opened dialog, go to Resource tab and type a name for the new layer in the field Display name. Then in WMS layer tab select [WMS connection](#ngcom-wms-connection), image format and WMS layers you want to add to Web GIS;
4. Press **Create** button. If WMS layer is created successfully, you’ll see its name in Child resources pane of the relevant Resource group.

Read more about connecting to external WMS servers here.

<a id="ngcom-tms-connect"></a>

## External TMS services

<a id="ngcom-tms-connection"></a>

### Create a TMS connection

1. Open Resource group where you want to create a connection (by default, from the main page of Web GIS you access the Main resource group);
2. Press **Create resource** and select **TMS connection**;
3. In the opened dialog, go to Resource tab and type a name for the new connection in the field Display name. Then in TMS connection tab select the mode for connection with TMS server (Custom or NextGIS GeoServices) and enter URL template, API key parameters and tile scheme;
4. Press **Create** button. If TMS connection is created successfully, you’ll see its name in Child resources pane of the relevant Resource group.

<a id="ngcom-tms-layer"></a>

### Create a TMS layer

1. Open Resource group where you want to create a data layer (by default, from the main page of Web GIS you access the Main resource group);
2. Press **Create resource** and select **TMS layer**;
3. In the opened dialog, go to Resource tab and type a name for the new layer in the field Display name. Then in the Tile cache tab choose cache settings, and in the TMS layer tab select the required TMS connection and set up display parameters;
4. Press **Create** button. If TMS layer is created successfully, you’ll see its name in Child resources pane of the relevant Resource group.

Read more about connecting to external TMS services here.
