Select to view content in your preferred language

Print Task Doesn't Plot All Services - Projection?

1808
8
Jump to solution
05-31-2013 10:55 AM
by Anonymous User
Not applicable
Original User: infindibular

I am using a PrintTask and Print Service to generate pdf and image version of a web map.

My services are pulled from two instances of ArcGIS server, one of which hosts the Print Service.

My problem is that data from the "foreign" ArcGIS server isn't displayed in the printed version of the maps.

I suspect a projection issue as one image service on the "foreign" server is in the same projection as my services, and it displays in the print.

Does anyone have a suggestion on how to make the other services, which I am not hosting, print? The API documentation does not address projection issues at all and the fact that I can view the data in the web map suggests that the print service should be able to display it as well.

In the attached images, the streets (w/ labels) and parcels (w/ labels) are the services that do not appear when printed and are in different projections, but the background imagery is from the same server (but in the native projection of the webmap).

[ATTACH=CONFIG]24870[/ATTACH][ATTACH=CONFIG]24871[/ATTACH]
0 Kudos
1 Solution

Accepted Solutions
by Anonymous User
Not applicable
Original User: jgravois

im not really sure where to pan the map to see your data, because the service doesn't draw features even in the sample JS viewer

i'm guessing your problem is caused by the fact that specifying the group layer only in the array of visible layers you are sending to the printService is not sufficient for sublayers to appear in the printout

//add the group layer and the specific sublayers of interest to the map so that they are both sent to the print service as well visLayers = [0,1,2,3] dynLayer.setVisibleLayers(visLayers);

View solution in original post

0 Kudos
8 Replies
by Anonymous User
Not applicable
Original User: jgravois

are the remote services public?
are any of the layers secure?
how are you loading those layers, as an ArcGISDynamicMapServiceLayer?
does it make any difference if you try printing using sampleserver6.arcgisonline.com?
what does the webmapJSON you are sending in the print request look like?
0 Kudos
NathanaelVaughan
Emerging Contributor
1) One server is public at
     http://mcgis.mohavecounty.us/ArcGIS/rest/services
     This server is running ArcGIS Server 10, while the other Server is running v. 10.1
     It is the "foreign" server for which some of the services do not print.
     http://mcgis.mohavecounty.us/ArcGIS/rest/services/PARCELS/MapServer doesn't display in printing, but
    http://mcgis.mohavecounty.us/ArcGIS/rest/services/ImageServer/ORTHO2010_NAIPDOQQS_NSRS2007_1meter/Im... does.
2) None of the services require authentication
3) Most of the layers are ArcGISDynamicMapServiceLayers, but some are ArcGISImageServiceLayers, and others are ArcGISTiledMapServiceLayers. Projection is StatePlane... and so ESRI-served tiled services are not being used. The services which are not plotting are ArcGISDynamicMapServiceLayers.
4) I haven't tried loading any of the ESRI-served layers. I'll dig around and find a generic MapService and try adding it.
5) I'll dig up the JSON and add it in another post. There didn't appear to be anything special or suspicious in the JSON when I reviewed it.

EDIT:

re: 4) I pulled in http://sampleserver6.arcgisonline.com/arcgis/rest/services/SampleWorldCities/MapServer and printed it to .pdf successfully, so it is not a projection issue.

re: 5) JSON:
{"mapOptions":{"showAttribution":false,"extent":{"xmin":-582369.7281529,"ymin":888607.0117303578,"xmax":2489154.663159769,"ymax":1711157.6325260433,"spatialReference":{"wkid":3483}},"spatialReference":{"wkid":3483}},"operationalLayers":[{"id":"bground_0","title":"bground_0","opacity":1,"minScale":2311162,"maxScale":1128.5,"url":"http://privateServer/arcgis/rest/services/Backgrounds/Background_2/MapServer"},{"id":"parcels_0","title":"parcels_0","opacity":1,"minScale":4514,"maxScale":1128.5,"url":"http://mcgis.mohavecounty.us/ArcGIS/rest/services/PARCELS/MapServer","visibleLayers":[0],"layers":[]},{"id":"mapping_0","title":"mapping_0","opacity":1,"minScale":2311162,"maxScale":1128.5,"url":"http://privateServer/arcgis/rest/services/Studies/Topography2/MapServer"},{"id":"ESRITest_0","title":"ESRITest_0","opacity":1,"minScale":0,"maxScale":0,"url":"http://sampleserver6.arcgisonline.com/arcgis/rest/services/SampleWorldCities/MapServer","visibleLayers":null,"layers":[]},{"id":"roads_0","title":"roads_0","opacity":1,"minScale":0,"maxScale":0,"url":"http://privateServer/arcgis/rest/services/Backgrounds/Streets_250k_4/MapServer","visibleLayers":null,"layers":[]},{"id":"roads_1","title":"roads_1","opacity":1,"minScale":36112,"maxScale":1128.5,"url":"http://mcgis.mohavecounty.us/ArcGIS/rest/services/ROADS/MapServer","visibleLayers":[5,10],"layers":[]},{"id":"labels_0","title":"labels_0","opacity":1,"minScale":0,"maxScale":0,"url":"http://privateServer/arcgis/rest/services/Backgrounds/Label_Points_2/MapServer","visibleLayers":null,"layers":[]}],"exportOptions":{"outputSize":[800,1100],"dpi":96}}
0 Kudos
by Anonymous User
Not applicable
Original User: infindibular

After messing around with layers for some time, the cause of the problem seems to be the use of setVisibleLayers on the ArcGISDynamicMapLayers.

When values are input into setVisibleLayers, the ArcGISDynamicMapLayers do not display through the printTask.

I have not determined if this only occurs with ArcGIS Server 10.0 layers or if it also extends to 10.1.
0 Kudos
by Anonymous User
Not applicable
Original User: jgravois

heres a fiddle that shows that you can print 10.0 services successfully after calling setVisibleLayers() on an ArcGISDynamicMapServiceLayer.

you could substitute another service like this one to see that it works with 10.1 services as well
0 Kudos
NathanaelVaughan
Emerging Contributor
I played with the fiddle and added one of my mis-behaving services - try this one (you will have to navigate to Mohave County, Arizona - just SE of Las Vegas, NV) - http://jsfiddle.net/jS7Gf/2/ - note that the parcels do not show in the printout.

Here is the same fiddle, but without toggling setVisibleLayers on the parcels - http://jsfiddle.net/jS7Gf/3/ - note that the parcels show in the printout.


What's wrong with the service?
0 Kudos
by Anonymous User
Not applicable
Original User: jgravois

im not really sure where to pan the map to see your data, because the service doesn't draw features even in the sample JS viewer

i'm guessing your problem is caused by the fact that specifying the group layer only in the array of visible layers you are sending to the printService is not sufficient for sublayers to appear in the printout

//add the group layer and the specific sublayers of interest to the map so that they are both sent to the print service as well visLayers = [0,1,2,3] dynLayer.setVisibleLayers(visLayers);
0 Kudos
NathanaelVaughan
Emerging Contributor
I modified the map settings to display the parcels at loading:
Prints Okay w/ no visible layer adjustment
Does not print parcels and layer visibility is modified
Prints parcels and layer visibility is modified

I read the response thoroughly enough to figure out the meaning.

The problem is caused by the reference to the Group Layer when setting the visible layers. I have group layer 0 set to display which contains layers 1, 2, and 3. If I specify to display 0, 1, 2, and 3, the plot and display match. If I specify only the group layer, 0, the display shows 0, 1, 2, and 3, but the plot does not.

Thanks for the help. I've posted three versions of the fiddle above with no visible layer modification, visible layer modification which prevents plotting, and visible layer modification that allows printing.
0 Kudos
by Anonymous User
Not applicable
Original User: jgravois

Is the suggestion for fixing that I modify the layers when printing to show all?

i made the code change i suggested in the above post and confirmed that it ensures your parcels appear in the printout as well.  thus, my suggestion is that in addition to specifying the id of the group layer you want to appear in your app, you also specify individual sublayers when calling setVisibleLayers().

i tend to agree with you that this is confusing, but you can specify only a group layer in the setVisibleLayers() array and see its corresponding sublayers in your application, but it is not sufficient to pass the same group layer ID only in the webmapJSON request to a print service.
0 Kudos