Skip to content

Commit

Permalink
Address review
Browse files Browse the repository at this point in the history
  • Loading branch information
nirvn committed Oct 6, 2024
1 parent 35c4f1d commit 423def0
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 4 deletions.
1 change: 1 addition & 0 deletions python/PyQt6/core/auto_generated/qgsmaplayerutils.sip.in
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@




class QgsMapLayerUtils
{
%Docstring(signature="appended")
Expand Down
1 change: 1 addition & 0 deletions python/core/auto_generated/qgsmaplayerutils.sip.in
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@




class QgsMapLayerUtils
{
%Docstring(signature="appended")
Expand Down
2 changes: 1 addition & 1 deletion src/analysis/processing/qgsalgorithmrasterize.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ QVariantMap QgsRasterizeAlgorithm::processAlgorithm( const QVariantMap &paramete
}
feedback->pushInfo( QStringLiteral( "%1" ).arg( totalTiles ) );

if ( totalTiles > 5000 )
if ( totalTiles > MAXIMUM_OPENSTREETMAP_TILES_FETCH )
{
// Prevent bulk downloading of tiles from openstreetmap.org as per OSMF tile usage policy
feedback->pushFormattedMessage( QObject::tr( "Layer %1 will be skipped as the algorithm leads to bulk downloading behavior which is prohibited by the %2OpenStreetMap Foundation tile usage policy%3" ).arg( rasterLayer->name(), QStringLiteral( "<a href=\"https://operations.osmfoundation.org/policies/tiles/\">" ), QStringLiteral( "</a>" ) ),
Expand Down
2 changes: 1 addition & 1 deletion src/analysis/processing/qgsalgorithmxyztiles.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ bool QgsXyzTilesBaseAlgorithm::prepareAlgorithm( const QVariantMap &parameters,

void QgsXyzTilesBaseAlgorithm::checkLayersUsagePolicy( QgsProcessingFeedback *feedback )
{
if ( mTotalTiles > 5000 )
if ( mTotalTiles > MAXIMUM_OPENSTREETMAP_TILES_FETCH )
{
for ( QgsMapLayer *layer : std::as_const( mLayers ) )
{
Expand Down
2 changes: 2 additions & 0 deletions src/core/qgsmaplayerutils.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
#ifndef QGSMAPLAYERUTILS_H
#define QGSMAPLAYERUTILS_H

#define MAXIMUM_OPENSTREETMAP_TILES_FETCH 5000

#include "qgis_sip.h"
#include "qgis_core.h"
#include "qgis.h"
Expand Down
4 changes: 2 additions & 2 deletions src/gui/qgsrasterlayersaveasdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -970,10 +970,10 @@ void QgsRasterLayerSaveAsDialog::accept()
const int nbTilesHeight = std::ceil( nRows() / 256 );
int64_t totalTiles = static_cast<int64_t>( nbTilesWidth ) * nbTilesHeight;

if ( totalTiles > 5000 )
if ( totalTiles > MAXIMUM_OPENSTREETMAP_TILES_FETCH )
{
QMessageBox::warning( this, tr( "Save Raster Layer" ),
tr( "The number of OpenStreetMap tiles needed to produce the raster layer is too large and will leads to bulk downloading behavior which is prohibited by the %1OpenStreetMap Foundation tile usage policy%2." ).arg( QStringLiteral( "<a href=\"https://operations.osmfoundation.org/policies/tiles/\">" ), QStringLiteral( "</a>" ) ),
tr( "The number of OpenStreetMap tiles needed to produce the raster layer is too large and will lead to bulk downloading behavior which is prohibited by the %1OpenStreetMap Foundation tile usage policy%2." ).arg( QStringLiteral( "<a href=\"https://operations.osmfoundation.org/policies/tiles/\">" ), QStringLiteral( "</a>" ) ),
QMessageBox::Ok );
return;
}
Expand Down

0 comments on commit 423def0

Please sign in to comment.