cmv-app
cmv-app copied to clipboard
Print Widget Scale Error
Using the out-of-the-box CMV, if I zoom in to a location and use the Print widget, the scale bar is incorrect - It didn't matter if I chose PDF or JPG....
I copied the scale bar and moved it to the location on the map, and used the measurement widget to create ticks at one mile increments:
I noticed that the scale bar was about 1.3 times shorter than it should be which is 1/cos(40°), my latitude. So I looked at Quito, Ecuador, and sure enough, the scale is correct:
The only way I found to fix it was to set the outSpatialReference in printParamerters to Colorado North State Plane
Changes to print.js:
this.printparams = new PrintParameters();
this.printparams.map = this.map;
this.printparams.outSpatialReference = new SpatialReference(2231); // Coloroado North State Plane
//this.printparams.outSpatialReference = this.map.spatialReference;
Seems like the scale bar should always be correct, and I shouldn't have to set the SpatialReference, or am I missing something?
Thanks.
I'm attaching the full size images of the output.....
@rick-gse thanks for the detailed description of your issue!
At first blush this seems like an issue with the AGS Print Service. If you don't explicitly provide a spatial reference as you did, the spatial reference of the map/basemap will be passed to the service. Here's an example:
"mapOptions": {
"showAttribution": false,
"extent": {
"xmin": -13015085.680169962,
"ymin": 2663677.561681053,
"xmax": -8490013.605688732,
"ymax": 6807175.990962787,
"spatialReference": {
"wkid": 102100,
"latestWkid": 3857
}
},
"spatialReference": {
"wkid": 102100,
"latestWkid": 3857
},
"scale": 18489297.737236
},
What Print Service are you using - your own or the Esri example? If your own, what version of AGS?
I suppose also the dpi sent with the request could make a difference but it shouldn't!
I am using the default from CMV, the ArcGIS Online one - printTaskURL: 'https://utility.arcgisonline.com/arcgis/rest/services/Utilities/PrintingTools/GPServer/Export%20Web%20Map%20Task',
my client is using their own PrintService on their 10.3 server, but we both have the problem.
And no, the DPI doesn't matter, or the size of the page, or the output type.
If I use the Scale Bar widget, it appears on the map correctly, everywhere, without having to specify the spatial reference....