<a id="ngmobile-load-geodata"></a>

# Add layers

In NextGIS Mobile there are several ways to add geodata:

* [create a new layer of chosen geometry](https://docs.nextgis.com/docs_ngmobile/source/load_geodata.html#ngmobile-create-vector);
* upload a vector or raster layer:
  * [from a file](https://docs.nextgis.com/docs_ngmobile/source/load_geodata.html#ngmobile-import-vector)
  * [from NextGIS Web](https://docs.nextgis.com/docs_ngmobile/source/ngw_load.html#ngmobile-add-layer-webgis) [cloud storage or on-premise server](http://nextgis.com/nextgis-web/);
  * from [QuickMapServices catalog](https://qms.nextgis.com/)
  * from an [external service](https://docs.nextgis.com/docs_ngmobile/source/load_geodata.html#ngmobile-add-geoservice) you have a link for.

<a id="ngmobile-create-vector"></a>

## Create empty layer

To create an empty vector layer, open the layer panel ![three lines](docs_ngmobile/source/_static/ic_layer_tree.png) and tap ![ic_add_layer](docs_ngmobile/source/_static/ic_add_layer.png).

![image](docs_ngmobile/source/_static/ngm_layer_tree_plus_en.png)

In the menu select **Create layer**.

![image](docs_ngmobile/source/_static/ngm_add_geodata_new_en.png)

A dialog opens that allows you to set up your layer.

![image](docs_ngmobile/source/_static/ngm_new_layer_name_en.png)

Set up the following parameters for the vector layer:

1. Name - required, enter a name to be displayed in the layer list.
2. Geometry type - select what geometry the layer features are going to be (point, linestring, polygon, multipoint, multilinestring, multipolygon).
3. Fields - a list of fields containing layer attributes.

If you only set the name and geometry type, by default the layer is created with two fields: technical field for feature identifier (fid) and a text field (description).

You can create a layer with as many fields as you need. Tap on the “+” next to the Fields label. A field creation dialog opens:

![image](docs_ngmobile/source/_static/ngm_add_field_en.png)

Set up the following parameters:

1. Field name, it will be used in the layer structure.

#### NOTE
Only use plain Latin symbols and numbers, no spaces. SQL keywords cannot be used for field names.

1. Field type - string, integer (32 bit), integer (64 bit), real, date&time, date, time.

#### SEE ALSO
To set up aliases for the fields you can [update the layer in Web GIS](https://docs.nextgis.com/docs_ngweb/source/layers.html#vector-layer-field-settings-pic). You can also create a [custom form](https://docs.nextgis.com/docs_ngweb/source/collector.html#collector-create-form) with field labels, comments and more intuitive controls for entering values.

To complete layer creation tap ![button_tick](docs_ngmobile/source/_static/button_tick.png) in the top right corner.

![image](docs_ngmobile/source/_static/ngm_fields_added_en.png)

New layer is added to the top of the layer list.

![image](docs_ngmobile/source/_static/ngm_new_layer_result_en.png)

Now you can:

* [Add features to the layer](https://docs.nextgis.com/docs_ngmobile/source/editing.html#ngmobile-add-geometry);
* [Send it to WebGIS](https://docs.nextgis.com/docs_ngmobile/source/ngw_load.html#ngmobile-upload) ;
* [Share the layer as a file](https://docs.nextgis.com/docs_ngmobile/source/share.html).

<a id="ngmobile-import-vector"></a>

## Create vector layer from a file

The following formats are supported:

* GeoJSON
* custom forms in \*.NGFP format (created in NextGIS Web, [see how to do it](https://docs.nextgis.com/docs_ngweb/source/collector.html#collector-create-form) )

Open the Layer tree panel ![three lines](docs_ngmobile/source/_static/ic_layer_tree.png), tap “Add geodata” ![ic_add_layer](docs_ngmobile/source/_static/ic_add_layer.png) and select **Open local**.

![image](docs_ngmobile/source/_static/ngm_add_local_en.png)

Next a pop-up opens where you can set a custom name for the layer:

![image](docs_ngmobile/source/_static/ngm_add_local_name_en.png)

Tap **Create** to start loading data. You can see the loading progress in a pop-up as well as in your device notifications.

![image](docs_ngmobile/source/_static/ngm_add_local_process_en.png)

New layer is placed at the top of the layer list:

![image](docs_ngmobile/source/_static/ngm_add_local_result_en.png)

See how you can modify the data in the section [Edit layers](editing.html.md#ngmobile-editing).

#### NOTE
Requirements for GeoJSON files

* The extension must be .geojson, or .geojson.zip - an archive that has the file in the root directory;
* Spacial reference system - only WGS 84 (EPSG:4326) or Web Mercator (EPSG:3857).
* If the file contains multiple geometry types,the first feature determines the geometry type and all other types are ignored.
* Text must be in UTF-8 encoding.

<a id="ngmobile-import-cache"></a>

## Create raster layer from file (tile cache)

The following formats are supported:

* XYZ/TMS in a ZIP-archive;
* MBTiles;
* \*.NGRC.

You can generate tile cache with a QGIS plugin called [QTiles](http://plugins.qgis.org/plugins/qtiles/) or use an online tool [Raster to NGRC](https://toolbox.nextgis.com/t/raster2tiles).

To load a raster layer into NextGIS Mobile:

Open the Layer tree panel ![three lines](docs_ngmobile/source/_static/ic_layer_tree.png), tap “Add geodata” ![ic_add_layer](docs_ngmobile/source/_static/ic_add_layer.png) and select **Open local**.

![image](docs_ngmobile/source/_static/ngm_add_local_en.png)

Select tile cache file from your device.

New raster layer is placed at the top of the layer list:

![image](docs_ngmobile/source/_static/ngm_add_tileszip_result_en.png)

#### NOTE
Requirements for tile archive

Z-level folders can be in the root of the archive or in a folder that’s in the root of the archive (name doesn’t matter, but there must be only one folder). Deeper nesting for Z-level folders is not supported.

<a id="ngmobile-add-geoservice"></a>

## Add geoservice

In NextGIS Mobile you can create raster layers from external geoservices (basemaps, for example)

The easiest way to do it is to pick a service from [QuickMapServices](qms.nextgis.com) catalog.

If you don’t want to depend on the availability of external services, you can host your own key-protected basemaps with [NextGIS GeoServices](https://docs.nextgis.com/docs_geoserv_prem/source/intro.html).

<a id="ngmobile-qms-service"></a>

### Add service from QuickMapServices catalog

To use a tile service from [QuickMapServices](https://qms.nextgis.com/) catalog:

Open the Layer tree panel ![three lines](docs_ngmobile/source/_static/ic_layer_tree.png), tap “Add geodata” ![ic_add_layer](docs_ngmobile/source/_static/ic_add_layer.png) and select **Add geoservice**.

![image](docs_ngmobile/source/_static/ngm_add_geoservice_en.png)

A pop-up opens displaying all services available in the QMS catalog. Start typing in the search bar the name of the service or some key words like `satellite`. Pick a service or several services from the search results by putting a tick next to them, then tap **Add** at the bottom of the screen.

![image](docs_ngmobile/source/_static/ngm_add_gs_qms_select_en.png)

New layer is placed at the top of the layer list:

![image](docs_ngmobile/source/_static/ngm_add_gs_qms_result_en.png)

#### HINT
Since it’s a raster layer, it covers all the layer below it. Drag the layer to a convenient place at the bottom of the layer tree.

<a id="ngmobile-tile-service"></a>

### Add custom tile service

To use a custom tile service not included in [QuickMapServices](https://qms.nextgis.com/) catalog:

Open the Layer tree panel ![three lines](docs_ngmobile/source/_static/ic_layer_tree.png), tap “Add geodata” ![ic_add_layer](docs_ngmobile/source/_static/ic_add_layer.png) and select **Add geoservice**.

![image](docs_ngmobile/source/_static/ngm_add_geoservice_en.png)

Tap **New**.

![image](docs_ngmobile/source/_static/ngm_add_gs_new_en.png)

A settings pop-up appears.

![image](docs_ngmobile/source/_static/ngm_gs_new_settings_en.png)

Enter at least two parameters:

* Layer name;
* URL.

Service URL determines the order of tile numbers (vertical, horizontal and zoom level). In the address, it’s marked by **{x}, {y}, {z}** in the corresponding order.

You can also add subdomains. For example, for subdomains `a.tile.openstreetmap.org, b.tile.openstreetmap.org, c.tile.openstreetmap.org` the URL is **{a,b,c}.tile.openstreetmap.org**.

You can also set:

* schema (how the tiles are cut): XYZ (OSM) or TMS (OSGeo);
* cache size: no cache, 1 screen, 2 or 3 screens;
* credentials (login and password) if thery are required to access the tiles.

#### NOTE
Only [Basic access authentication](http://en.wikipedia.org/wiki/Basic_access_authentication) is supported.

When all is set, tap **Create**. The new layer is placed at the top of the layer list.

<a id="ngmobile-tile-cache"></a>

### Cache tile service data

You can work with data from external geoservices even **without Internet connection**. To make it possible, download tiles for your area of interest.

Make sure that the raster layer is added to the Layer tree and visible.

Open the map at the extend of the area you want to download tiles for.

Open the layer menu and select **Download tiles**.

![image](docs_ngmobile/source/_static/select_download_tiles_en.png)

In the pop-up window select the necessary zoom range. Tap **Start**.

![image](docs_ngmobile/source/_static/cache_zoom_levels_en.png)![image](docs_ngmobile/source/_static/cache_progress_en.png)

#### WARNING
If the total number of tiles of the selected range is over 6000, only the first 6000 tiles are downloaded. The rest won’t be downloaded to avoid memory overload.

Cache layer is added to the top of the layer list and marked by a downward arrow.

![image](docs_ngmobile/source/_static/cache_result_en.png)

Now even when there’s no connection the tiles for the are will be displayed in the app.

#### SEE ALSO
[How to add a layer from Web GIS](https://docs.nextgis.com/docs_ngmobile/source/ngw_load.html).
