/
qgsvectortilewriter.sip.in
206 lines (167 loc) · 7.12 KB
/
qgsvectortilewriter.sip.in
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
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/vectortile/qgsvectortilewriter.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/
class QgsVectorTileWriter
{
%Docstring(signature="appended")
Takes care of writing vector tiles. The intended use is to set up the class
by setting the destination URI, extent, zoom level range and input vector
layers. Then with a call to :py:func:`~writeTiles` the data gets written. In case
of a failure, :py:func:`~errorMessage` returns the cause of the problem during writing.
The syntax of destination URIs is the same like the data source string
used by vector tile layers: parameters are encoded as a HTTP query string,
where "type" key determines the type of the destination container,
the "url" key is normally the path. Currently supported types:
- "xyz" - tile data written as local files, using a template where {x},{y},{z}
are replaced by the actual tile column, row and zoom level numbers, e.g.:
file:///home/qgis/tiles/{z}/{x}/{y}.pbf
- "mbtiles" - tile data written to a new MBTiles file, the "url" key should
be ordinary file system path, e.g.: /home/qgis/output.mbtiles
Currently the writer only support MVT encoding of data.
Metadata support: it is possible to pass a QVariantMap with metadata. This
is backend dependent. Currently only "mbtiles" source type supports writing
of metadata. The key-value pairs will be written to the "metadata" table
in the MBTiles file. Some useful metadata keys listed here, but see MBTiles spec
for more details:
- "name" - human-readable name of the tileset
- "bounds" - extent in WGS 84: "minlon,minlat,maxlon,maxlat"
- "center" - default view of the map: "longitude,latitude,zoomlevel"
- "minzoom" - lowest zoom level
- "maxzoom" - highest zoom level
- "attribution" - string that explains the sources of data
- "description" - descriptions of the content
- "type" - whether this is an overlay or a basemap
- "version" - version of the tileset
Vector tile writer always writes "format" and "json" metadata. If not specified
in metadata by the client, tile writer also writes "name", "bounds", "minzoom"
and "maxzoom".
.. versionadded:: 3.14
%End
%TypeHeaderCode
#include "qgsvectortilewriter.h"
%End
public:
QgsVectorTileWriter();
class Layer
{
%Docstring(signature="appended")
Configuration of a single input vector layer to be included in the output
.. versionadded:: 3.14
%End
%TypeHeaderCode
#include "qgsvectortilewriter.h"
%End
public:
explicit Layer( QgsVectorLayer *layer );
%Docstring
Constructs an entry for a vector layer
%End
QgsVectorLayer *layer() const;
%Docstring
Returns vector layer of this entry
%End
QString filterExpression() const;
%Docstring
Returns filter expression. If not empty, only features matching the expression will be used
%End
void setFilterExpression( const QString &expr );
%Docstring
Sets filter expression. If not empty, only features matching the expression will be used
%End
QString layerName() const;
%Docstring
Returns layer name in the output. If not set, :py:func:`~Layer.layer`->:py:func:`~Layer.name` will be used.
%End
void setLayerName( const QString &name );
%Docstring
Sets layer name in the output. If not set, :py:func:`~Layer.layer`->:py:func:`~Layer.name` will be used.
%End
int minZoom() const;
%Docstring
Returns minimum zoom level at which this layer will be used. Negative value means no min. zoom level
%End
void setMinZoom( int minzoom );
%Docstring
Sets minimum zoom level at which this layer will be used. Negative value means no min. zoom level
%End
int maxZoom() const;
%Docstring
Returns maximum zoom level at which this layer will be used. Negative value means no max. zoom level
%End
void setMaxZoom( int maxzoom );
%Docstring
Sets maximum zoom level at which this layer will be used. Negative value means no max. zoom level
%End
};
void setDestinationUri( const QString &uri );
%Docstring
Sets where and how the vector tiles will be written.
See the class description about the syntax of destination URIs.
%End
void setExtent( const QgsRectangle &extent );
%Docstring
Sets extent of vector tile output.
If unset, it will use the full extent of all input layers combined
%End
void setMinZoom( int minZoom );
%Docstring
Sets the minimum zoom level of tiles. Allowed values are in interval [0,24]
%End
void setMaxZoom( int maxZoom );
%Docstring
Sets the maximum zoom level of tiles. Allowed values are in interval [0,24]
%End
void setLayers( const QList<QgsVectorTileWriter::Layer> &layers );
%Docstring
Sets vector layers and their configuration for output of vector tiles
%End
void setMetadata( const QVariantMap &metadata );
%Docstring
Sets that will be written to the output dataset. See class description for more on metadata support
%End
void setTransformContext( const QgsCoordinateTransformContext &transformContext );
%Docstring
Sets coordinate transform context for transforms between layers and tile matrix CRS
%End
bool setRootTileMatrix( const QgsTileMatrix &tileMatrix );
%Docstring
Sets zoom level 0 tile matrix
%End
bool writeTiles( QgsFeedback *feedback = 0 );
%Docstring
Writes vector tiles according to the configuration.
Returns ``True`` on success (upon failure one can get error cause using :py:func:`~QgsVectorTileWriter.errorMessage`)
If a pointer to a feedback object is provided, it can be used to track progress or
provide cancellation functionality.
%End
QString errorMessage() const;
%Docstring
Returns error message related to the previous call to :py:func:`~QgsVectorTileWriter.writeTiles`. Will return
an empty string if writing was successful.
%End
QgsRectangle fullExtent() const;
%Docstring
Returns calculated extent that combines extent of all input layers
%End
QByteArray writeSingleTile( QgsTileXYZ tileID, QgsFeedback *feedback = 0, int buffer = 256, int resolution = 4096 ) const;
%Docstring
Encodes single MVT tile
:param tileID: Tile identifier
:param feedback: optional, provide cancellation functionality
:param resolution: the resolution of coordinates of geometries within the tile. The default is 4096
:param buffer: size of the buffer zone around tile edges in integer tile coordinates. The default is 256 (~6%)
Returns a QByteArray with the encoded data
.. versionadded:: 3.22
%End
};
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/vectortile/qgsvectortilewriter.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/