1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
<html>
<head>
<title>NextGIS Web</title>
</head>
<body bgcolor="#ffffff">
<h1>NextGIS Web</h1>
NextGIS Web - is a server GIS, which allows to store and edit geodata and to
display maps in web browser. Also NextGIS Web can share geodata with other
NextGIS software.
<p>
NextGIS Web has the following features:
<ul>
<li> Display maps in a web browser (different maps with different layers and
styles)
<li> Flexible permissions management
<li> Load geodata from PostGIS or import from GIS formats (ESRI Shape,
GeoJSON or GeoTIFF)
<li> Load vector geodata in the following formats: GeoJSON, CSV, ESRI Shape
<li> Import map styles from QGIS project or set them manually
<li> Act as a server for TMS, WMS, WFS
<li> Act as a client for WMS
<li> User can add photos to records, change record attributes via web
interface or WFS-T protocol
</ul>
NextGIS Web - is an open source software (license GPL v2+, see
<a href="https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html">
GNU General Public License, version 2</a>).
<h2>Driver</h2>
The driver is available since GDAL/OGR >= <b>2.4</b>. This driver can connect to
the services implementing the NextGIS Web API. GDAL/OGR must be built with Curl
support in order for the NGW driver to be compiled.
The driver supports read and write operations.
<h2>Dataset name syntax</h2>
The minimal syntax to open a NGW datasource is:
NGW:[NextGIS Web URL][/resource/][resource identifier]
<ul>
<li><b>NextGIS Web URL</b> may be an url to nextgis.com cloud service (for
example, https://demo.nextgis.com), or some other url including port and
additional path (for example, http://192.168.1.1:8000/test).
<li><b>resource</b> is mandatory keyword dividing resource identifier from
the rest of URL.
<li><b>resource identifier</b> this is positive number from 0 and above. This
may be a resource group, vector, PostGIS or raster layer, style.
</ul>
If identifier is resource group, all vector layers, PostGIS, raster layers, styles
will listed as child resources. In other case this will be a separate layer.
<h2>Configuration options</h2>
The following configuration options are available:
<ul>
<li><b>NGW_USERPWD</b>: User name and password separated with colon. Optional
and can be set using open options.
<li><b>NGW_BATCH_SIZE</b>: Size of feature insert and update operations cache
before send to server. If batch size is -1 batch mode is disabled. Delete
operation will execute immediately.
<li><b>NGW_PAGE_SIZE</b>: If supported by server, fetch features from
remote server will use paging. The -1 value disables paging even it
supported by server.
<li><b>NGW_NATIVE_DATA</b>: Whether to store the json <i>extensions</i> key
in feature native data.
<li><b>NGW_JSON_DEPTH</b>: The depth of json response that can be parsed. If
depth is greater than this value, parse error occurs.
</ul>
<h2>Authentication</h2>
Any operations (read, write, get metadata, change properties, etc.) may require
an authenticated access. Authenticated access is obtained by specifying user name
and password in open, create or configuration options.
<h2>Feature</h2>
If the NATIVE_DATA open option is set to YES, the <i>extensions</i> json object
will be stored as a serialized json object in the NativeData property of the
OGRFeature object (and "application/json" in the NativeMediaType property).
On write, if a OGRFeature to be written has its NativeMediaType property set to
"application/json" and its NativeData property set to a string that is a
serialized json object, then members of this object will be set to <i>extensions</i>
json object of feature.
<p>
Extensions json object structure see in
<a href="http://docs.nextgis.comu/docs_ngweb_dev/doc/developer/resource.html#feature">
NextGIS Web API documentation</a>
<h2>Geometry</h2>
NextGIS Web supports only one geometry column. Default spatial reference is Web
Mercator (EPSG:3857). The following geometry types are available:
<ul>
<li>POINT
<li>LINESTRING
<li>POLYGON
<li>MULTIPOINT
<li>MULTILINESTRING
<li>MULTIPOLYGON
</ul>
<h2>Field data types</h2>
NextWeb supports only following field types:
<ul>
<li>OFTInteger
<li>OFTInteger64
<li>OFTReal
<li>OFTString
<li>OFTDate
<li>OFTTime
<li>OFTDateTime
</ul>
<h2>Paging</h2>
Features can retrieved from NextGIS Web by chunks if supported by server (available
since NextGIS Web 3.1). This chunk size can be altered with the NGW_PAGE_SIZE
configuration option or PAGE_SIZE open option.
<h2>Write support</h2>
Datasource and layers creation and deletion is possible.
Write support is only enabled when the datasource is opened in update mode and
user has permissions.
Vector and PostGIS layers insert and update operations may be cached if BATCH_SIZE
is greater 0. Delete operation executes immediately.
<h2>Open options</h2>
The following open options are available:
<ul>
<li>USERPWD - Username and password, separated by colon.
<li>PAGE_SIZE=-1 - Limit feature count while fetching from server. Default
value is -1 - no limit.
<li>BATCH_SIZE=-1 - Size of feature insert and update operations cache before
send to server. If batch size is -1 batch mode is disabled. Default value
is -1.
<li>NATIVE_DATA=NO - Whether to store the json <i>extensions</i> key in
feature native data. Default value is NO.
<li>JSON_DEPTH=32 - The depth of json response that can be parsed. If
depth is greater than this value, parse error occurs.
</ul>
<h2>Dataset creation options</h2>
The following dataset/datasource creation options are available:
<ul>
<li>KEY - Key value. Must be unique in whole NextGIS Web instance. Optional.
<li>DESCRIPTION - Resource description. Optional.
<li>USERPWD - Username and password, separated by colon.
<li>PAGE_SIZE=-1 - Limit feature count while fetching from server. Default
value is -1 - no limit.
<li>BATCH_SIZE=-1 - Size of feature insert and update operations cache before
send to server. If batch size is -1 batch mode is disable. Default value
is -1.
<li>NATIVE_DATA=NO - Whether to store the json <i>extensions</i> key in
feature native data. Default value is NO.
<li>JSON_DEPTH=32 - The depth of json response that can be parsed. If
depth is greater than this value, parse error occurs.
</ul>
<h2>Layer creation options</h2>
The following layer creation options are available:
<ul>
<li>OVERWRITE - Whether to overwrite an existing table with the layer name
to be created. The resource will delete and new one will created. This
leads that resource identifier will change. Defaults to NO. Optional.
<li>KEY - Key value. Must be unique in whole NextGIS Web instance. Optional.
<li>DESCRIPTION - Resource description. Optional.
</ul>
<h2>Metadata</h2>
NextGIS Web metadata are supported in datasource, vector, PostGIS, raster layers
and styles. Metadata are stored at specific domain "NGW". NextGIS Web supported
metadata are strings and numbers. Metadata keys with decimal numbers will have
suffix <b>.d</b> and for real numbers - <b>.f</b>. To create new metadata item,
add new key=value pair in NGW domain use the <i>SetMetadataItem</i> function and
appropriate suffix. During transferring to NextGIS Web, suffix will be omitted. You
must ensure that numbers correctly transform from string to number.
<p>
Resource description and key map to appropriate <i>description</i> and
<i>keyname</i> metadata items in default domain. Changing those metadata items
will cause an update of resource properties.
<p>
Resource creation date, type and parent identifier map to appropriate
read-only metadata items <i>creation_date</i>, <i>resource_type</i> and
<i>parent_id</i> in default domain.
<p>
Vector layer field properties (alias, identifier, label field, grid visibility)
map to layer metadata the following way:
<ul>
<li>field alias -> FIELD_{field number}_ALIAS (for example FIELD_0_ALIAS)
<li>identifier -> FIELD_{field number}_ID (for example FIELD_0_ID)
<li>label field -> FIELD_{field number}_LABEL_FIELD (for example FIELD_0_LABEL_FIELD)
<li>grid visibility -> FIELD_{field number}_GRID_VISIBILITY (for example FIELD_0_GRID_VISIBILITY)
</ul>
<h2>Filters</h2>
Vector and PostGIS layers support SetIgnoredFields method. Any cached
features will be freed then this method executed.
<p>
Vector and PostGIS layers support SetAttributeFilter and SetSpatialFilter methods.
The SetAttributeFilter method accepts only field equal value condition and AND
operator without brackets. For example,
<pre>FIELD_1 = 'Value 1'</pre>
<pre>FIELD_1 = 'Value 1' AND FIELD_2 = 'Value 2'</pre>
In other cases attribute filter will be evaluated on client side.
<p>
You can set attribute filter using NextGIS Web native format. For example,
<pre>NGW:fld_FIELD_1=Value 1&fld_FIELD_2=Value 2</pre>
Don't forget to add 'NGW:' perefix to where clause and 'fld_' prefix to field name.
<p>
Dataset supports ExecuteSQL method. Only the following queries are supported:
<ul>
<li>DELLAYER: layer_name; - delete layer with layer_name.
<li>DELETE FROM layer_name; - delete any features from layer with layer_name.
<li>DROP TABLE layer_name; - delete layer with layer_name.
<li>ALTER TABLE src_layer RENAME TO dst_layer; - rename layer.
<li>SELECT field_1,field_2 FROM src_layer WHERE field_1 = 'Value 1' AND field_2 = 'Value 2';
</ul>
In SELECT statement field list or asterisk can be provided. The WHERE clause has
same limitations as SetAttributeFilter method input.
<h2>Examples</h2>
Read datasource contensts (1730 is resource group identifier):
<pre>
ogrinfo -ro NGW:https://demo.nextgis.com/resource/1730
</pre>
<p>
Read layer details (1730 is resource group identifier):
<pre>
ogrinfo -ro -so NGW:https://demo.nextgis.com/resource/1730 Parks
</pre>
<p>
Creating and populating a vector layer from a shapefile in resource group with identifier 1730. NEw vector layer name will be "myshapefile":
<pre>
ogr2ogr -f NGW "NGW:https://demo.nextgis.com/resource/1730/myshapefile" myshapefile.shp
</pre>
<p>
<h3>See also:</h2>
<ul>
<li><a href="http://docs.nextgis.com/docs_ngweb/source/toc.html">
NextGIS Web documentation</a>
<li><a href="http://docs.nextgis.com/docs_ngweb_dev/doc/toc.html">
NextGIS Web for developers</a>
</ul>
</body>
</html>