33 const QVariantMap tileInfo = json.value( QStringLiteral(
"tileInfo" ) ).toMap();
35 const QVariantMap origin = tileInfo.value( QStringLiteral(
"origin" ) ).toMap();
36 const double originX = origin.value( QStringLiteral(
"x" ) ).toDouble();
37 const double originY = origin.value( QStringLiteral(
"y" ) ).toDouble();
39 const int rows = tileInfo.value( QStringLiteral(
"rows" ), QStringLiteral(
"512" ) ).toInt();
40 const int cols = tileInfo.value( QStringLiteral(
"cols" ), QStringLiteral(
"512" ) ).toInt();
43 QgsDebugMsg( QStringLiteral(
"row/col size mismatch: %1 vs %2 - tile misalignment may occur" ).arg( rows ).arg( cols ) );
48 const QVariantList lodList = tileInfo.value( QStringLiteral(
"lods" ) ).toList();
49 bool foundLevel0 =
false;
50 double z0Dimension = 0;
52 for (
const QVariant &lod : lodList )
54 const QVariantMap lodMap = lod.toMap();
55 const int level = lodMap.value( QStringLiteral(
"level" ) ).toInt();
58 z0Dimension = lodMap.value( QStringLiteral(
"resolution" ) ).toDouble() * rows;
67 for (
const QVariant &lod : lodList )
69 const QVariantMap lodMap = lod.toMap();
70 const int level = lodMap.value( QStringLiteral(
"level" ) ).toInt();
79 tm.
setScale( lodMap.value( QStringLiteral(
"scale" ) ).toDouble() );
@ Esri
No scale doubling, always rounds down when matching to available tile levels.
static QgsCoordinateReferenceSystem convertSpatialReference(const QVariantMap &spatialReferenceMap)
Converts a spatial reference JSON definition to a QgsCoordinateReferenceSystem value.
This class represents a coordinate reference system (CRS).
A class to represent a 2D point.
void addGoogleCrs84QuadTiles(int minimumZoom=0, int maximumZoom=14)
Adds tile matrices corresponding to the standard web mercator/GoogleCRS84Quad setup.
QgsCoordinateReferenceSystem crs() const
Returns the coordinate reference system associated with the tiles.
int minimumZoom() const
Returns the minimum zoom level for tiles present in the set.
int maximumZoom() const
Returns the maximum zoom level for tiles present in the set.
void addMatrix(const QgsTileMatrix &matrix)
Adds a matrix to the set.
void setScaleToTileZoomMethod(Qgis::ScaleToTileZoomLevelMethod method)
Sets the scale to tile zoom method.
Defines a matrix of tiles for a single zoom level: it is defined by its size (width *.
void setScale(double scale)
Sets the scale denominator of the tile matrix.
static QgsTileMatrix fromCustomDef(int zoomLevel, const QgsCoordinateReferenceSystem &crs, const QgsPointXY &z0TopLeftPoint, double z0Dimension, int z0MatrixWidth=1, int z0MatrixHeight=1)
Returns a tile matrix for a specific CRS, top left point, zoom level 0 dimension in CRS units.
Encapsulates properties of a vector tile matrix set, including tile origins and scaling information.
bool fromEsriJson(const QVariantMap &json)
Initializes the tile structure settings from an ESRI REST VectorTileService json map.
static QgsVectorTileMatrixSet fromWebMercator(int minimumZoom=0, int maximumZoom=14)
Returns a vector tile structure corresponding to the standard web mercator/GoogleCRS84Quad setup.