10.5. Adding layers

NextGIS Mobile allows to create new empty vector layers or import vector and raster layers from Android local storage, QuickMapServices catalog, nextgis.com or NextGIS Web. The supported data types are:

  • GeoJSON;

  • XYZ/TMS tile cache in ZIP-archive;

  • tile cache in *.ngrc format;

  • custom forms in *.ngfp format.

To add a basemap use a service as described below.

10.5.1. Creating new vector layer

Here are the steps to create an empty vector layer:

  1. Open Layers tree panel (item 1 in Pic. 10.3.). Then tap on “Add geodata” button (item 4 in Pic. 10.4.). The dialogue will open as shown in Pic. 10.14.. Select “Create layer”.

../../_images/options_menu_new_layer.png

Pic. 10.14. Add geodata dialogue

  1. In the opened dialogue enter the parameters of new vector layer (see Pic. 10.15.)

../../_images/input_form_attributes_new_layer.png

Pic. 10.15. Parameters of the new vector layer

The standard form for the creation of new vector layer contains the following parameters:

  1. Layer name - enter the name of layer which will be displayed in the layers tree.

  2. Geometry type - select layer geometry type (point, linestring, polygon, multipoint, multilinestring, multipolygon).

  3. Fields - list of fields which can be added, edited or deleted. These are attribute values of the layer.

You can add as many attributes for a new vector layer as you like. To add a new attribute tap on “+” button next to “Fields”. This will open a new dialogue for creation of each new field (see Pic. 10.16.).

../../_images/dialogue_create_new_field.png

Pic. 10.16. Dialog for creation of a new field

Dialog for creation of a new field contains the following parameters:

  1. Field name – enter the name of the field.

Note

The field name can only be entered in Latin characters (letters and numbers!) without spaces. It should also differ from SQL reserved keywords.

  1. Field type - select field type from one of the following types: string, integer, biginteger, real, date&time, date, time.

10.5.2. Creating vector layer from GeoJSON data

NextGIS Mobile allows to create a vector layer by importing an existing GeoJSON file. To open data in GeoJSON format:

  1. Open Layers tree panel (item 1 in Pic. 10.3.). Then tap on “Add geodata” button (item 4 in Pic. 10.4.). The dialogue will open as shown in Pic. 10.14.. Select “Open local”.

  2. Select GeoJSON file from your mobile device storage (see Pic. 10.17.). For example, tap on the file “Roads.geojson” to import the “Roads” vector data file.

../../_images/saved_files_on_the_drive_unit.png

Pic. 10.17. Android local storage

  1. When the file is selected Layer settings dialogue opens. Here you can specify a new vector layer name or keep the name as it is, e.g. “Roads” (see Pic. 10.18.).

../../_images/layer_settings_geo.png

Pic. 10.18. Layer settings dialogue

  1. Pressing “Create” button starts data processing for creation of a new layer.

Note

In case of GeoJSON file importing the new layer will always be a vector layer!

You can check if the new layer was created successfully in the layers tree panel. The newly created layer will be shown up in the layers tree (see Pic. 10.19.). The “Roads” layer is marked in orange rectangle.

../../_images/tree_layers_geo.png

Pic. 10.19. Layers tree panel

GeoJSON: format requirements

  • Coordinate system of input geometries can be WGS 84 (EPSG:4326) or Web Mercator (EPSG:3857) only. If input file has different coordinate system you will see a warning message about unsupported coordinate system.

  • All geometries in the file must be of the same type. If input file contains varying types of geometry in the output you will have a file with geometries type that coincides with the type of first record, i.e. geometry of first entry will determine the type of layer geometry.

  • Text strings must be encoded in UTF-8 format.

Note

You can read more about GeoJSON format in its specification. GeoJSON is based on JSON format (see RFC 4627).

You can only use standard attributes form (not custom *.ngfp form) for editing GeoJSON layer.

The standard attributes form contains only following three fields:

  1. Text field for entering characters or digits.

  2. Dialogue for entering date & time.

  3. “Add pictures” button.

A sample standard attributes form is shown below in Pic. 10.20..

../../_images/input_form_attributes.png

Pic. 10.20. Standard attributes form

The numbers indicate: 1 - Back to previous screen; 2 - Apply changes; 3 - Add pictures.

You can further perform standard edit operations like Add, Modify or Delete operations for this layer. For more information about GeoJSON layer editing see Editing a geometry.

10.5.3. Creating vector layer from Custom forms (NGFP)

NextGIS Mobile allows to create a vector layer by importing an existing NGFP file.

NGFP files can be generated using NextGIS FormBuilder. NGFP is a GeoJSON file with additional information (JSON) which is packaged in zip archive and has .ngfp extension.

NGFP file allows to use custom (not standard) attributes forms optimized for attributes viewing and editing. Custom form may contain special controls for editing, such as dropdown lists, radio buttons or linked lists.

../../_images/custom_form.png

Pic. 10.21. Custom attributes form

The numbers indicate: 1 - Back to previous screen; 2 - Apply changes; 3 - Settings; 4 - Text or Integer; 5 - Dropdown list; 6 - Date & Time; 7 - Radio buttons.

Follow these steps to open NGFP file in NextGIS Mobile:

  1. Open Layers tree panel (item 1 in Pic. 10.3.). Then tap on “Add geodata” button (item 4 in Pic. 10.4.). The dialogue will open as shown in Pic. 10.14.. Select “Open local”.

  2. Select NGFP file from your mobile device storage (see Pic. 10.22.). For example, tap on the file “Structures.ngfp” to import the “Structures” form.

../../_images/saved_files_on_the_drive_unit.png

Pic. 10.22. Android local storage

  1. When the file is selected Layer settings dialogue opens. Here you can specify a new vector layer name or keep the name as it is, e.g. “Structures” (see Pic. 10.23.):

../../_images/settind_layer_form.png

Pic. 10.23. Layer settings dialogue

  1. Pressing “Create” button starts data processing for creation of a new vector layer.

You can check if the new layer was created successfully in the layers tree panel. The newly created layer will be shown up in the layers tree in the layers tree (see Pic. 10.19.). The “Structures” layer is shown in orange rectangle.

../../_images/tree_layers_ngfp.png

Pic. 10.24. Layers tree panel

You can further perform standard edit operations like Add, Modify or Delete operations for this vector layer. For more information about NGFP layer editing see Editing a geometry.

10.5.4. Creating raster layer from Tile cache (XYZ/TMS)

NextGIS Mobile allows to create a raster layer by importing tile cache.

Tile cache is a zip-archive with folders and tiles stored in accordance with a tiling scheme (for example, folder_z/folder_x/y.png). Folders of level Z can be located in the root or in a folder in the root folder (name of the folder doesn’t matter, but there have to be only one folder). Deeper nesting of level Z folders is not allowed.

Tile cache can be created with the extension module NextGIS QGIS - QTiles. Resulted archive can be uploaded to any available folder in your mobile device storage.

Follow these steps to open zip-archive with tile cache:

  1. Open Layers tree panel (item 1 in Pic. 10.3.). Then tap on “Add geodata” button (item 4 in Pic. 10.4.). The dialogue will open as shown in Pic. 10.14.. Select “Open local”.

  2. Select zip-archive from your mobile device storage (see Pic. 10.25.). For example, tap on the file “mapnik.zip” to import the tile cache:

../../_images/files_on_the_drive_unit_tms.png

Pic. 10.25. Android local storage

  1. When zip-archive is selected a layer settings dialog opens (see Pic. 10.26.):

../../_images/layer_setting_tms.png

Pic. 10.26. Tile layer settings dialog

Here you can select tile layer type (tile structure system) - XYZ (OSM) or TMS (OSGeo) (see Pic. 10.27.) and in-memory cache size (see Pic. 10.28.):

../../_images/layer_setting_tms_2.png

Pic. 10.27. Tile structure settings dialog

../../_images/layer_setting_tms_3.png

Pic. 10.28. Cache size settings dialog

  1. Pressing “Create” button starts data processing for creation of a new raster layer (see Pic. 10.29.).

../../_images/processing_and_creation_layer_tms.png

Pic. 10.29. Data processing for creation of a new layer from tiles

You can check if the new raster layer was created successfully in the Layers tree panel. The newly created raster layer will be shown up in the layers tree first in the Layers tree (see Pic. 10.30.).

../../_images/tree_layers_tms.png

Pic. 10.30. Layers tree panel

10.5.5. Creating raster layer from Tile cache (NGRC)

NextGIS Mobile also allows to create a raster layer by importing tile cache in *.ngrc format. NGRC files can be created from virtually any geodata in QGIS using our QTiles plugin.

Follow these steps to import tile cache in *.ngrc format :

  1. Open Layers tree panel (item 1 in Pic. 10.3.). Then tap on “Add geodata” button (item 4 in Pic. 10.4.). The dialogue will open as shown in Pic. 10.14.. Select “Open local”.

  2. Select *.ngrc file from your mobile device storage (see Pic. 10.31.). For example, tap on the file “Tandali_Wadgaon.ngrc” to import the “Tandali Wadgaon” tile cache prepared using satellite raster image.

../../_images/saved_files_on_the_drive_unit.png

Pic. 10.31. Android local storage

  1. NextGIS Mobile will start data processing for creation of a new raster layer. You can check if the new layer was created successfully in the Layers tree panel. The newly created layer will be shown up in the layers tree in the layers tree as shown in (see Pic. 10.32.). The “Tandali_Wadgaon” layer is shown in orange rectangle.

../../_images/tree_layers_ngrc.png

Pic. 10.32. Layers tree panel

10.5.6. Creating raster layer from external geoservice

NextGIS Mobile also supports creation of raster layers from external geoservices. For example, you can use them to add basemaps.

Warning

You need to be Online while creating layer from external geoservice. It will consume your data pack & apply standard Internet charges from your Internet service provider.

10.5.6.1. Creating raster layer from QuickMapServices tile service

Follow these steps to add raster layer from TMS services listed in QuickMapServices catalog:

  1. Open Layers tree panel (item 1 in Pic. 10.3.). Then tap on “Add geodata” button (item 4 in Pic. 10.4.). The dialogue will open as shown in Pic. 10.14.. Select “Add geoservice” and the dialogue will open as shown in Pic. 10.33. below.

../../_images/ngmobile_add_geoservice.png

Pic. 10.33. Add Geoservice dialogue

  1. Select a geoservice you want to add and tap “Add” to create raster layer from that service. The newly created layer will be shown up in the layers tree in Layers tree.

10.5.6.2. Creating raster layer from private tile service

If you want to add tile service not listed in QuickMapServices catalog you can do it by following these steps:

  1. Tap “New” in above Pic. 10.33.. It will open up “Create” dialogue for a new TMS service as shown in Pic. 10.34. below.

../../_images/ngmobile_new_geoservice.png

Pic. 10.34. Create TMS service dialogue

  1. Specify Layer name & Layer URL. Layer URL should specify location of X value (number of tile by horizontal), Y (number of tile by vertical) and Z (zoom level). These values are specified using wildcard code for X - {x}, for Y - {y}, for Z - {z}. Additionally you can specify subdomains (e.g. for subdomains a.tileopenstreetmap.org, b.tileopenstreetmap.org, c.tileopenstreetmap.org the address will look like this: {a,b,c}.tile.openstreetmap.org).

Note

NextGIS Mobile requests tiles from each URL (subdomain) in 2 streams. So from URL like {a,b,c}.tile.openstreetmap.org tiles will be downloaded in 6 streams.

  1. You can also specify Tile layer type (XYZ (OSM) and TMS (OSGeo) standards are supported), TMS in-memory cache size (none, 1, 2 or 3 screens) and credentials (Login & Password) if authentication is required for accessing tiles.

Note

Only Basic access authentication is currently supported.

  1. Tap “Create” to create new raster layer from that TMS service. The newly created layer will be shown up in the layers tree in Layers tree.

10.5.6.3. Caching of tile service data

You can work Offline with raster layers created from external geoservices. In order to do it you need to download tiles for your area of interest to your device before going into the field:

  1. Make sure raster layer you need in the field is added to Map screen and is visible. Then open the map extent you want to download tiles for.

  2. Open Layers tree panel (item 1 in Pic. 10.3.). Then find raster layer in Layers tree and tap Layer contextual menu icon (item 5 in Pic. 10.4.).

  3. Tap “Download tiles” button in Layer contextual menu as shown in Pic. 10.35. below.

../../_images/download_tiles.png

Pic. 10.35. Download tiles button

  1. A new dialogue will open as shown in Pic. 10.36.. Select zoom levels you need and tap “Start” button.

../../_images/levels_of_zoom.png

Pic. 10.36. Select zoom levels dialogue

Note

The lower selected zoom levels, the smaller number of tiles for an area of interest will have to be downloaded and the faster they will be downloaded. You can track downloading progress in Android Status Bar. Notifications for NextGIS Mobile app should be switched ON in System Settings.

Warning

If number of tiles to download for selected zoom levels is more than 6000 tiles for each zoom level, only first 6000 tiles for each zoom level will be downloaded. The rest will not be downloaded due to danger of memory overflow.

10.5.7. Adding geodata from Web GIS

NextGIS Mobile supports uploading of geodata from Web GIS created at nextgis.com cloud service or on-premise.

You can learn more about uploading geodata to Web GIS in the following sections: Raster layer and Vector layer.

To add files/geodata from Web GIS to NextGIS Mobile:

  1. Open Layers tree panel (item 1 in Pic. 10.3.). Then tap on Add geodata button (item 4 in Pic. 10.4.). The dialogue will open as shown in Pic. 10.37.. Select “Add from Web GIS”.

../../_images/ngmobile_addition_of_NextGIS_eng.png

Pic. 10.37. Adding from Web GIS

  1. In opened dialogue select “Add Web GIS” and tap Add button (see Pic. 10.38.):

../../_images/ngmobile_add_an_account_NextGIS_eng.png

Pic. 10.38. Adding Web GIS connection

  1. Enter your Web GIS name and password set on nextgis.com, then tap Sign in button (see Pic. 10.39.):

../../_images/ngmobile_conversation_connection_WebGIS_eng.png

Pic. 10.39. Web GIS adding dialog

If you’re adding geodata from an on-premise Web GIS, first you need to change the authentification server.

  1. After the connection is successful you will see the list of available Web GIS. Select the one you added (see Pic. 10.40.):

../../_images/ngmobile_account_election_Web_GIS_eng.png

Pic. 10.40. Selecting Web GIS

  1. The dialog of layer selection for importing geodata from your Web GIS to NextGIS Mobile will open (see Pic. 10.41.):

../../_images/ngmobile_layer_selection_dialog_for_importing_eng.png

Pic. 10.41. Selecting layer for geodata import

If Web GIS layer has a style, there is a possibility to choose not only vector data, but also raster data for importing. Vector data are downloading to the mobile device and can be used offline. Raster data can be used only online. A vector layer can be added/imported either as vector or as raster data. Tick off the type for the layer in the right side of the screen (see Pic. 10.42.):

../../_images/ngmobile_layer_type_selection_eng.png

Pic. 10.42. Layer type selection

Tap the button in the upper right corner of the screen to create a new group of data in your Web GIS. Specify a name for the group and tap “OK”. In the case of the success you will see it in your Web GIS window (see Pic. 10.43.):

../../_images/ngmobile_add_a_new_group_eng.png

Pic. 10.43. Adding a new group

  1. After the layer selection for importing from your Web GIS to NextGIS Mobile, tap “Add” button. The importing process will begin. The newly created layer will be shown up in the layers tree in Layers tree.