Export Web Map / Print Task, force BaseMap min scale

2721
3
Jump to solution
02-01-2016 02:35 PM
DaveOrlando
Occasional Contributor III

Hello,

Is there any way to force the BaseMap to draw at its minimal scale, instead of receiving 'Map data not available' tiles.

I guess JavaScript is allowing the BaseMap to draw past the last scale but the Print Service does not?.....

Very tough to explain to a public user that what they see is NOT what they get.

0 Kudos
1 Solution

Accepted Solutions
DaveOrlando
Occasional Contributor III

so, this isn't so much a solution, but a workaround to avoid the 'map data not available' tiles.

this code will force the print service to draw at the last available scale of the basemap. you must find the last scale for your specific area. World_Topo_Map (MapServer)  For my area, the basemap quits at Level 20, so I set the scale to 847 which is just barely past halfway between Level 19 (1128) and Level 20 (564)

so the end user does not get the exact scale that they see on the screen, but they also don't get the dreaded 'map data not available' tiles.

this is in the Print Widget's Print.js about line 270 (V1.3). I added the else statement.

printDefInspector: function(printDef) {
    //do what you want here then return the object.
    if (this.preserve.preserveScale === 'force') {
        printDef.mapOptions.scale = this.preserve.forcedScale;
    }
    else if (printDef.mapOptions.scale < 847) {           
        printDef.mapOptions.scale = 847;
    }       
    return printDef;
},

View solution in original post

3 Replies
RickeyFight
MVP Regular Contributor
DaveOrlando
Occasional Contributor III

so, this isn't so much a solution, but a workaround to avoid the 'map data not available' tiles.

this code will force the print service to draw at the last available scale of the basemap. you must find the last scale for your specific area. World_Topo_Map (MapServer)  For my area, the basemap quits at Level 20, so I set the scale to 847 which is just barely past halfway between Level 19 (1128) and Level 20 (564)

so the end user does not get the exact scale that they see on the screen, but they also don't get the dreaded 'map data not available' tiles.

this is in the Print Widget's Print.js about line 270 (V1.3). I added the else statement.

printDefInspector: function(printDef) {
    //do what you want here then return the object.
    if (this.preserve.preserveScale === 'force') {
        printDef.mapOptions.scale = this.preserve.forcedScale;
    }
    else if (printDef.mapOptions.scale < 847) {           
        printDef.mapOptions.scale = 847;
    }       
    return printDef;
},
CartoPlus
New Contributor

Hi all,

I was wondering if anyone found another solution or workaround to this issue ?
I would really like to avoid having to change the printing scale so that it matches the minimum available scale of the basemap (as we're talking about scales around 200 the change is really obvious from one to another)

 

Thanks !

0 Kudos