cmv-app icon indicating copy to clipboard operation
cmv-app copied to clipboard

Print Widget Scale Error

Open rick-gse opened this issue 7 years ago • 3 comments

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:

image

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:

image

The only way I found to fix it was to set the outSpatialReference in printParamerters to Colorado North State Plane

image

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.....

colo broke

quito

colo fixed

rick-gse avatar Mar 01 '17 18:03 rick-gse

@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!

tmcgee avatar Mar 01 '17 18:03 tmcgee

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.

rick-gse avatar Mar 01 '17 19:03 rick-gse

If I use the Scale Bar widget, it appears on the map correctly, everywhere, without having to specify the spatial reference....

image

rick-gse avatar Mar 01 '17 21:03 rick-gse