10.1.6. Miscellaneous

Identification by polygon

To get features intersect a polygon execute following request.

PUT /feature_layer/identify

Identification request

Request JSON Object:
 
  • srs (int) – Spatial reference id
  • geom (string) – Polygon in WKT
Request JSON Array of Objects:
 
  • layers (int) – layes id array

Example request:

POST /feature_layer/identify HTTP/1.1
Host: ngw_url
Accept: */*

{
    "srs":3857,
    "geom":"POLYGON((4188625.8318882 7511123.3382522,4188683.1596594 7511123.
                     3382522,4188683.1596594 7511180.6660234,4188625.8318882
                     7511180.6660234,4188625.8318882 7511123.3382522))",
    "layers":[2,5]
}

Example response:

{
  "2": {
    "featureCount": 1,
    "features": [
      {
        "fields": {
          "Id": 25,
          "name": "\u0426\u0435\u0440\u043a\u043e\u0432\u044c \u0412\u0432
                   \u0435\u0434\u0435\u043d\u0438\u044f \u041f\u0440\u0435
                   \u0441\u0432\u044f\u0442\u043e\u0439 \u0411\u043e\u0433
                   \u043e\u0440\u043e\u0434\u0438\u0446\u044b \u0432\u043e
                   \u0425\u0440\u0430\u043c \u043d\u0430 \u0411\u043e\u043b
                   \u044c\u0448\u043e\u0439 \u041b\u0443\u0431\u044f\u043d
                   \u043a\u0435, 1514-1925"
        },
        "id": 3,
        "label": "#3",
        "layerId": 2
      }
    ]
  },
  "5": {
    "featureCount": 0,
    "features": []
  },
  "featureCount": 1
}

Get resource data

Geodatata can be fetched for vector and raster layers. For vector layers (PostGIS and Vector) geodata returns in GeoJSON or CSV formats. For raster layers (Raster, WMS) - tiles (:term`TMS`:) or image. For QGIS styles - qml file.

The following request returns GeoJSON file from vector layer:

Не рекомендуется, начиная с версии 2.2.

GET /resource/(int: id)/geojson/

Добавлено в версии 3.0.

GET /api/resource/(int: id)/geojson

GeoJSON file request

Parameters:
  • id – resource identificator

Example request:

GET /api/resource/55/geojson HTTP/1.1
Host: ngw_url
Accept: */*

The following request returns CSV file from vector layer:

Добавлено в версии 3.0.

GET /api/resource/(int: id)/csv

CSV file request

Parameters:
  • id – resiurce identificator

Example request:

GET /api/resource/55/csv HTTP/1.1
Host: ngw_url
Accept: */*

The following request returns TMS from raster layer:

Не рекомендуется, начиная с версии 2.2.

GET /resource/(int: id)/tms?z=(int: z)&x=(int: x)&y=(int: y)

Добавлено в версии 3.0.

GET /api/component/render/tile?z=(int: z)&x=(int: x)&y=(int: y)&resource=(int: id1),(int: id2)...

Tile request

Parameters:
  • id2 (id1,) – style resources id’s
  • z – zoom level
  • x – tile number on x axis (horisontal)
  • y – tile number on y axis (vertical)

Примечание

Styles order should be from lower to upper.

Example request:

GET /api/component/render/tile?z=7&x=84&y=42&resource=234 HTTP/1.1
Host: ngw_url
Accept: */*

The following request returns QML from QGIS style:

Добавлено в версии 3.0.1.

GET /api/resource/(int: id)/qml

QML file request

Parameters:
  • id – resiurce identificator

Example request:

GET /api/resource/56/qml HTTP/1.1
Host: ngw_url
Accept: */*

User managment

To get user desctription by it identificator execute following request:

Добавлено в версии 2.3.

GET /api/component/auth/user/(int: id)

Example request:

GET /api/component/auth/user/4 HTTP/1.1
Host: ngw_url
Accept: */*

Example response:

{
  "description": null,
  "disabled": false,
  "display_name": "\u0410\u0434\u043c\u0438\u043d\u0438\u0441\u0442\u0440\u0430\u0442\u043e\u0440",
  "id": 4,
  "keyname": "administrator",
  "member_of": [
    5
  ],
  "superuser": false,
  "system": false
}

To create new user execute following request:

Добавлено в версии 2.3.

POST /api/component/auth/user/

Request to create new user.

Request JSON Object:
 
  • display_name (string) – user full name
  • keyname (string) – user login
  • description (string) – user description
  • password (string) – user password

Example request:

POST /api/component/auth/user/ HTTP/1.1
Host: ngw_url
Accept: */*

{
  "description": null,
  "display_name": "another test",
  "keyname": "test1",
  "password": "test123"
}

Example response:

{
  "id": 4
}

To create new group execute following request:

Добавлено в версии 2.3.

POST /api/component/auth/group

Request to create new group

To self create user (anonymouse) execute following request:

Добавлено в версии 2.3.

POST /api/component/auth/register

Request to create new user

Request JSON Object:
 
  • display_name (string) – user full name
  • keyname (string) – user login
  • description (string) – user description
  • password (string) – user password

Administrator can configure anonymous user registration to the specific group (via setting checkbox on group in administrative user interface).

The special section must be in NGW config file:

[auth]
register = true