Printout from Custom Print Service doesn't match the Map Display

1514
4
05-17-2021 05:40 AM
SailiTang1
New Contributor III

Hi,

I am using ArcGIS API for Javascript 3.32 to develop a web application https://enstools.electionsnovascotia.ca/mapguidebook/. For “Print map” function, I published our custom Print service using Pro. I noticed an issue that some labels disappear on Printed map. The following map was shown in the web application. The attached pdf file is the printed map. You can notice that  the labels ”Beech Hill Rd”, “Henry Hatt Rd” don’t show on the printed map.

SailiTang1_1-1621254180762.png

This is my Print template code:

 

 

 // create the print templates
                var templates = arrayUtils.map(layouts, function (lo) {
                    var t = new PrintTemplate();
                    t.layout = lo.name;
                    t.label = lo.label;
                    t.format = lo.format;
                    t.layoutOptions = lo.options;
                    t.preserveScale = true;  
                    t.exportOptions = {
                        width: 800,
                        height: 1100,
                        dpi: 500
                    };
                    return t;
                });

 

 

 

Do you know what reason causes this issue? How to fix it? To test it, you can choose "08" for "Electoral District" and "006" for "Polling Division".  Thanks for your help.

Saili

Tags (1)
0 Kudos
4 Replies
LongDinh
Occasional Contributor II

Hi SailiTang1,

The scale range on your page may be different to that of your web application's screen which may cause the printed version to hide the label.

You can check the label class of your layer of interest to see if there is a min/max scale set and that it finds within the bounds of the printed map's scale. To verify the scale, compare the layer's label class settings with a scale added in your print template.

Alternatively use your browser's developer tool to look at the web map object parsed to your print service. To do so, open your browser's developer tools and go to the network tab. When you click print map on your widget, you will find an execute (synchronous) or submitJob (Asynchronous) request with the Web_Map_As_Json parameter which contains a representation of your current web application's web map. 

Copy it to a text editor and search for the "mapOptions.scale" to verify map scale and search the layer for it's label class min/max scales.

If the template has the layers added in, it may be that the scale range needs to be set in the template itself.

I hope this information helps. Best of luck!

 

 

0 Kudos
SailiTang1
New Contributor III

Thanks for your reply, LongDinh.

Yes, the printout scale is different from the map view's if you use the link above to test. This is the product version of this application and the preserveScale was set to "False", which causes the differences between printout scale and map view scale. Before I do some changes on this product version, I need to do some tests on my test version of this app. So I changed the preserveScale to "True" and then both scales look the same, but the labels were still missing, which is what is shown on the screenshot and attachment above.

I also did the other test, which was changing my current road vector tile map to ESRI's "https://basemaps.arcgis.com/arcgis/rest/services/OpenStreetMap_v2/VectorTileServer" and the road label display has no problem. The map view screenshot is as follows and the printout pdf was attached.

SailiTang1_0-1621425977301.jpeg

The other test I did is creating an ArcGIS online web application (https://electionsns.maps.arcgis.com/apps/webappviewer/index.html?id=7fc05d4f51e64bb082edaa74e3d0eb31) using the same map service and vector tile service, but the Print widget of web app builder, and the printout map's road label is still missing. So I guess that my issue should be the road label setting, but I don't know how I should change it.

I did use the way you recommended above to check the scale, thank you,  but there was no too much useful information about it because the road layer is one of the layers of a vector tile service.

Thank you so much for your help!

Saili

0 Kudos
LongDinh
Occasional Contributor II

Glad to you had some success Saili!

There are a couple of tricks you can try to 'force' the labels to appear. Since you're relying on the Vector Tile Server labels which are stored server-side, you will need to determine the level/scale at which the labels appear. Then you can do one of the following in your template/WebMap:

  1. If page count is important but not page size, then, set the map scale to the vector tile label scale and increase your page size to include all features of interest (as they may be cut off),
  2. If vice versa, set the map scale to the vector tile label scale and produce a set of series maps,

Alternatively, you can make use of your government's spatial data catalogue. According to your app, I believe the catalogue is located here: https://nsgi.novascotia.ca/gdd/. For example:

  1. Add your LGA's roads map service url into your template and use it as label layer: https://nsgiwa.novascotia.ca/arcgis/rest/services/TRNS/TRNS_NSRN_Addressed_Roads_UT83/MapServer
  2. Download your LGA's roads data and add it to your template and have the label appear at all scales and hide the polylines. https://data.novascotia.ca/Roads-Driving-and-Transport/Nova-Scotia-Road-Network-NSRN-/484g-adjn 

 

0 Kudos
SailiTang1
New Contributor III

Hi LongDinh,

Thanks for your suggestions.

I think that I have resolved this issue. This issue was caused by a problem of our vector tile package (I don’t know what the problem is.). When we created our vector tile package, we used default tiling scheme VTTS_2961_NAD_1983_CSRS_UTM_Zone_20N.xml. I still don’t know why it caused my issue. So I used my map to generate a new tiling scheme, use it to create a vector tile package and then publish it. The issue is gone. I haven’t done a lot of tests on it yet, so I don’t know if there are other issues caused by the new tiling scheme, but at least so far, the label issue is gone. 

Your suggestions really gave me some ideas. Thanks for your help.

Saili