Skip to content
Permalink
Browse files

Add processing test for the vector tile writer alg

  • Loading branch information
wonder-sk committed May 7, 2020
1 parent 299be94 commit 502429a0c0222636256e86a97e80535e38fa53da
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -2170,6 +2170,21 @@ tests:
type: directory
name: expected/xyztiles

- algorithm: native:writevectortiles_xyz
name: Generate vector tiles (Directory)
params:
LAYERS:
- layer: ../../../../../tests/testdata/lines.shp
- layer: ../../../../../tests/testdata/points.shp
- layer: ../../../../../tests/testdata/polys.shp
MAX_ZOOM: 3
MIN_ZOOM: 1
XYZ_TEMPLATE: '{z}/{x}/{y}.pbf'
results:
OUTPUT_DIRECTORY:
type: directory
name: expected/xyztiles_vector

- algorithm: native:calculatevectoroverlaps
name: Overlap analysis 1
ellipsoid: GRS80
@@ -106,15 +106,15 @@ QgsProcessingAlgorithm *QgsWriteVectorTilesXyzAlgorithm::createInstance() const

void QgsWriteVectorTilesXyzAlgorithm::initAlgorithm( const QVariantMap & )
{
addParameter( new QgsProcessingParameterFolderDestination( QStringLiteral( "OUTPUT_DIR" ), QObject::tr( "Output directory" ) ) );
addParameter( new QgsProcessingParameterFolderDestination( QStringLiteral( "OUTPUT_DIRECTORY" ), QObject::tr( "Output directory" ) ) );
addParameter( new QgsProcessingParameterString( QStringLiteral( "XYZ_TEMPLATE" ), QObject::tr( "File template" ), QStringLiteral( "{z}/{x}/{y}.pbf" ) ) );

addBaseParameters();
}

void QgsWriteVectorTilesXyzAlgorithm::prepareWriter( QgsVectorTileWriter &writer, const QVariantMap &parameters, QgsProcessingContext &context, QVariantMap &outputs )
{
QString outputDir = parameterAsString( parameters, QStringLiteral( "OUTPUT_DIR" ), context );
QString outputDir = parameterAsString( parameters, QStringLiteral( "OUTPUT_DIRECTORY" ), context );
QString xyzTemplate = parameterAsString( parameters, QStringLiteral( "XYZ_TEMPLATE" ), context );
QgsDataSourceUri dsUri;
dsUri.setParam( QStringLiteral( "type" ), QStringLiteral( "xyz" ) );
@@ -123,7 +123,7 @@ void QgsWriteVectorTilesXyzAlgorithm::prepareWriter( QgsVectorTileWriter &writer

writer.setDestinationUri( uri );

outputs.insert( QStringLiteral( "OUTPUT_DIR" ), outputDir );
outputs.insert( QStringLiteral( "OUTPUT_DIRECTORY" ), outputDir );
}

//

0 comments on commit 502429a

Please sign in to comment.
You can’t perform that action at this time.