QGIS API Documentation 3.40.0-Bratislava (b56115d8743)
Loading...
Searching...
No Matches
Static Public Member Functions | Friends | List of all members
QgsVectorTileUtils Class Reference

Random utility functions for working with vector tiles. More...

#include <qgsvectortileutils.h>

Static Public Member Functions

static bool checkXYZUrlTemplate (const QString &url)
 Checks whether the URL template string is correct (contains {x}, {y} / {-y}, {z} placeholders)
 
static QString formatXYZUrlTemplate (const QString &url, QgsTileXYZ tile, const QgsTileMatrix &tileMatrix)
 Returns formatted tile URL string replacing {x}, {y}, {z} placeholders (or {-y} instead of {y} for TMS convention)
 
static void loadSprites (const QVariantMap &styleDefinition, QgsMapBoxGlStyleConversionContext &context, const QString &styleUrl=QString())
 Downloads the sprite image and sets it to the conversion context.
 
static QgsFields makeQgisFields (const QSet< QString > &flds)
 Returns QgsFields instance based on the set of field names.
 
static QgsVectorLayermakeVectorLayerForTile (QgsVectorTileLayer *mvt, QgsTileXYZ tileID, const QString &layerName)
 Returns a temporary vector layer for given sub-layer of tile in vector tile layer.
 
static double scaleToZoom (double mapScale, double z0Scale=559082264.0287178)
 Finds zoom level given map scale denominator.
 
static int scaleToZoomLevel (double mapScale, int sourceMinZoom, int sourceMaxZoom, double z0Scale=559082264.0287178)
 Finds the best fitting zoom level given a map scale denominator and allowed zoom level range.
 
static void sortTilesByDistanceFromCenter (QVector< QgsTileXYZ > &tiles, QPointF center)
 Orders tile requests according to the distance from view center (given in tile matrix coords)
 
static QPolygon tilePolygon (QgsTileXYZ id, const QgsCoordinateTransform &ct, const QgsTileMatrix &tm, const QgsMapToPixel &mtp)
 Returns polygon (made by four corners of the tile) in screen coordinates.
 
static void updateUriSources (QString &uri SIP_INOUT, bool forceUpdate=false)
 Parses the style URL to update the source URLs in the uri.
 

Friends

class TestQgsVectorTileUtils
 

Detailed Description

Random utility functions for working with vector tiles.

Since
QGIS 3.14

Definition at line 48 of file qgsvectortileutils.h.

Member Function Documentation

◆ checkXYZUrlTemplate()

bool QgsVectorTileUtils::checkXYZUrlTemplate ( const QString &  url)
static

Checks whether the URL template string is correct (contains {x}, {y} / {-y}, {z} placeholders)

Definition at line 285 of file qgsvectortileutils.cpp.

◆ formatXYZUrlTemplate()

QString QgsVectorTileUtils::formatXYZUrlTemplate ( const QString &  url,
QgsTileXYZ  tile,
const QgsTileMatrix tileMatrix 
)
static

Returns formatted tile URL string replacing {x}, {y}, {z} placeholders (or {-y} instead of {y} for TMS convention)

Definition at line 268 of file qgsvectortileutils.cpp.

◆ loadSprites()

void QgsVectorTileUtils::loadSprites ( const QVariantMap &  styleDefinition,
QgsMapBoxGlStyleConversionContext context,
const QString &  styleUrl = QString() 
)
static

Downloads the sprite image and sets it to the conversion context.

Parameters
styleDefinitionthe style definition map
contextthe style conversion context
styleUrloptional the style url

Definition at line 314 of file qgsvectortileutils.cpp.

◆ makeQgisFields()

QgsFields QgsVectorTileUtils::makeQgisFields ( const QSet< QString > &  flds)
static

Returns QgsFields instance based on the set of field names.

Definition at line 194 of file qgsvectortileutils.cpp.

◆ makeVectorLayerForTile()

QgsVectorLayer * QgsVectorTileUtils::makeVectorLayerForTile ( QgsVectorTileLayer mvt,
QgsTileXYZ  tileID,
const QString &  layerName 
)
static

Returns a temporary vector layer for given sub-layer of tile in vector tile layer.

Definition at line 226 of file qgsvectortileutils.cpp.

◆ scaleToZoom()

double QgsVectorTileUtils::scaleToZoom ( double  mapScale,
double  z0Scale = 559082264.0287178 
)
static

Finds zoom level given map scale denominator.

The z0Scale argument gives the scale denominator at zoom level 0, where the default value corresponds to GoogleCRS84Quad tile matrix set

Since
QGIS 3.16

Definition at line 206 of file qgsvectortileutils.cpp.

◆ scaleToZoomLevel()

int QgsVectorTileUtils::scaleToZoomLevel ( double  mapScale,
int  sourceMinZoom,
int  sourceMaxZoom,
double  z0Scale = 559082264.0287178 
)
static

Finds the best fitting zoom level given a map scale denominator and allowed zoom level range.

The z0Scale argument gives the scale denominator at zoom level 0, where the default value corresponds to GoogleCRS84Quad tile matrix set.

Definition at line 214 of file qgsvectortileutils.cpp.

◆ sortTilesByDistanceFromCenter()

void QgsVectorTileUtils::sortTilesByDistanceFromCenter ( QVector< QgsTileXYZ > &  tiles,
QPointF  center 
)
static

Orders tile requests according to the distance from view center (given in tile matrix coords)

Definition at line 307 of file qgsvectortileutils.cpp.

◆ tilePolygon()

QPolygon QgsVectorTileUtils::tilePolygon ( QgsTileXYZ  id,
const QgsCoordinateTransform ct,
const QgsTileMatrix tm,
const QgsMapToPixel mtp 
)
static

Returns polygon (made by four corners of the tile) in screen coordinates.

Exceptions
QgsCsException

Definition at line 179 of file qgsvectortileutils.cpp.

◆ updateUriSources()

void QgsVectorTileUtils::updateUriSources ( QString &uri  SIP_INOUT,
bool  forceUpdate = false 
)
static

Parses the style URL to update the source URLs in the uri.

If forceUpdate is true, any existing source will be updated.

Since
QGIS 3.40

Definition at line 43 of file qgsvectortileutils.cpp.

Friends And Related Symbol Documentation

◆ TestQgsVectorTileUtils

friend class TestQgsVectorTileUtils
friend

Definition at line 111 of file qgsvectortileutils.h.


The documentation for this class was generated from the following files: