4

I am fairly new to arcgis, please bear with me here.

ISSUE:

  • I uses standard esri.dijit.Print for map printing.
  • The base map displays normally in my map pane at all zoom levels.
  • The printing function works as expected for all except one zoom level.
  • When the map is zoom-in to the maximum level, the print result can show graphics from every layer except the base map. If only the base map and a single feature layer is selected, the result will show an mostly empty map with those feature graphics on it.
  • No javascript error and task response success.
  • tried comparing a successful print request of other zoom level with the failed request, no meaningful difference except the map extent.

lib version: 3.10.

connected via Lan

Request: http://xx.xx.xx.xx/arcgis/rest/services/Utilities/PrintingTools/GPServer/Export%20Web%20Map%20Task/execute

Part of Web_Map_as_JSON: (note that the "land" layer is actually the base map I was referring to in the question)

"mapOptions":{"showAttribution":true,"extent":{"xmin":829211.7728597418,"ymin":840643.6650277233,"xmax":829322.236622336,"ymax":840675.9442589484,"spatialReference":{"wkid":102140,"latestWkid":2326}},"spatialReference":{"wkid":102140,"latestWkid":2326}},"operationalLayers":[{"id":"land","title":"land","opacity":1,"minScale":640000,"maxScale":1000,"url":"http://xxxx/MapServer"},{"id":"basemap","title":"basemap","opacity":1,"minScale":0,"maxScale":0,"url":"http://xxxx/MapServer"}

User-Agent:Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.106 Safari/537.36

Does anyone have any idea where to even start with the debugging?

2

This could be happening for a couple of reasons.

  1. The "land" layer in your example json (or another layer not in your example) could be drawing on top of the basemap. The print task will order the layers according to your json. so if the land layer is first in operationalLayers it will draw on top of every other layer (it's like being at the top of the TOC in arcmap). Depending on what's in the layers above the basemap they could be masking it. I've seen layers that work fine in arcmap or as a map service on a web map but when sent to the print service, they mask everything beneath them.

    You can test this out pretty quickly by going to your print endpoint: http://xx.xx.xx.xx/arcgis/rest/services/Utilities/PrintingTools/GPServer/Export%20Web%20Map%20Task/execute and entering the webmap json with every layer but the basemap layer removed. If you get a blank map then this probably isn't the issue.

  2. Stefan may be on the right track about your internet connection. It's probably not your internet connection but it might be the print server's. More specifically it might be a security or proxy issue. Without knowing more about your setup I can't be sure but the best way to troubleshoot this is to see if you can run the print task from the server via arcmap.

    • In Arcmap 10 navigate to Toolboxes -> System Toolboxes -> Server Tools -> Printing -> Export Web Map

    • In the Export Web Map dialog enter your webmap json and other parameters and click ok.

  3. unless your browser window is set to exactly the proportions of the data frame in the print template then the print service has to make adjustments to either the scale of the map or the extent. The preserveScale option on the print template (template.preserveScale = true;) controls this. The default setting for this is true though so if you're not explicitly setting it to false somewhere then it's probably not your problem.

There's a lot of other potential areas to troubleshoot but these should get you started.

  • thank a lot, i'll take a look at those in depth. for 1), i am only printing the minimum amount of map layer plus a single feature layer, the result is the feature graphics shown as result but base map is empty. so overlapping shouldn't be issue. 2), it would be kinda odd if it's actually the case, despite the fact i use LAN, I can successfully print everything on any other zoom level 100% of the time. – Jacky Cheng Dec 22 '15 at 1:34
  • Check out this documentation. developers.arcgis.com/javascript/jsapi/imageparameters-amd.html. im not sure from your description if you are only using a feature layer or also have a dynamic layer. If you do have a dynamic service layer then it could have an opaque background that covers up the basemap. Of course if it prints at all other zoom levels that seems unlikely. I would try printing with only the basemap to see if you can get it to show up at all and work from there. – Ryan Dec 22 '15 at 3:06
  • Cool, I'll take a look at that. Thanks for the help! – Jacky Cheng Dec 22 '15 at 8:38
2

I had the same issue and resolved it by setting the outScale option in conjunction with preserveScale in the PrintTemplate for the print task.

After sending multiple requests via the "Execute Task (Export Web Map Task)" REST interface and tweaking the "scale" in the mapOptions of the Web Map as JSON input it looks like a scale within 0.001 of the max scale for the basemap resulted in the basemap printing blank, so a quick test with setting outScale achieved the desired result--trying to set the scale of the map directly before printing via Map.setScale did not achieve this when I tried it, neither did feeding the result of scaleUtils.getExtentForScale to Map.setExtent and adding the deferred callbacks to trigger the print task execution.

Wanted this to apply for any basemap the map might be using so I also added a test to see whether the map scale is close to the basemap when trying to print. Example code:

var template = new esri.tasks.PrintTemplate();

// ...set other template properties...

// bump up the outScale to +1 of the basemap's maxScale if the map scale is close
var basemap = map.getLayer("layerIdOfYourBasemap");
if ((map.getScale() - basemap.maxScale) < 1) {
    template.outScale = basemap.maxScale + 1;
    template.preserveScale = true;
}
1

This issue can be related to your internet connection. Maybe you need to wait a little bit longer for the basemap to be loaded?

Another thing you can do is debugging your page with the console. For google chrome you can use the instructions on this site: https://developers.google.com/web/tools/chrome-devtools/debug/console/console-ui?hl=en#opening-the-console

  • thanks for the help, now that you ask I think i need to add more information to the question. It's very unlikely due to slow connection as the testing client is connected to map server via lan. There are no javascript error of any sort. I'll post the request and response in the question. – Jacky Cheng Dec 21 '15 at 10:29
  • The min- and maxScale properties for the basemap layer are both 0, so the javascript api will italic"ignore"italic those values. You can try to alter these values and see what happens. – Stefan Dec 21 '15 at 11:00
  • i just tried it, somehow setting the min max scale in program doesn't take effect when printing. (I tried setting land map's scale and I can change that). I've also compared a successful print request of other zoom level with the failed print map request, the only difference seems to be the map extent. – Jacky Cheng Dec 22 '15 at 1:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.