Select to view content in your preferred language

Is it possible to utilize a print service with Multiple Data Frames in Web App Builder?

2575
7
07-27-2018 09:42 AM
JamalWest2
Regular Contributor

I have published a print service that has  2 data frames( "DataFrame1","DataFrame2")in the print template. I would  like to be able to print 2 layers, 1 in each data frame. When I use the print task I only get the top layer(or what is visible at the scale) printed in DataFrame1, which was the active data frame when I published the service.DataFrame2 is just blank. How can I access and utilize DataFrame2? I have not been able to access it through any of the properties of the printtask object or the layout object.

0 Kudos
7 Replies
RobertScheitlin__GISP
MVP Emeritus

Jamal,

   I don't believe that is possible. A second data frame can be used for static data like a overview map or something but the Print Task does not provide access to manipulate a dataframe.

0 Kudos
JamalWest2
Regular Contributor

This is pretty much what I'm finding. Not sure what other options I have.

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

I am not aware of any.

0 Kudos
JamalWest2
Regular Contributor

I was able to achieve this using the Arcpy mapping module in a geoprocessing service. 

by Anonymous User
Not applicable

I'm trying to create a print service that has multiple data frames in the layout as well. Could you elaborate on how you were able to achieve this? Thanks

0 Kudos
JamalWest2
Regular Contributor

Margaret,

I created a template in Arcmap with 2 data frames. I then added my layers to both data frames(There is likely a more efficient way to do this, but since I was only using 10 layers I did it this way). In the python script I used the web map as json format to fake a webmap in. I then used the ConvertWebMapToMapDocument tool to create a print. 

Web_Map_as_JSON = {
"mapOptions": {
"extent": {
"xmin": -121.2525,
"ymin": 47.3671,
"xmax": -122.8498,
"ymax": 46.7341,
"spatialReference": {
"wkid": 2927,
"latestWkid": 2927
}
},
},
"operationalLayers": [],
"baseMap": {
"title": "cartoRoads",
"baseMapLayers": [
{
"id": "cartoRoads_1751",
"layerType": "ArcGISTiledMapServiceLayer",
"url": "",
"visibility": true,
"opacity": 1,
"title": "cartoRoads"
}
]

},
"exportOptions":{},
"layoutOptions":{},
"authoringApp": "WebMapViewer",
"authoringAppVersion": "6.2",
"version": "2.12",
"applicationProperties": {
"viewing": {
"routing": {
"enabled": true
},
"measure": {
"enabled": true
},
"basemapGallery": {
"enabled": true
}
}
}
}

###The webmap_as_json parameter isn't really that important if you're using your own template.

templateMxd = (r'\\'filePATH'\TestLayout.mxd')
result = arcpy.mapping.ConvertWebMapToMapDocument(Web_Map_as_JSON, templateMxd)
mxd = result.mapDocument

ImgLayer1 = sys.argv[1]#(This is simply the name of the layer sent as a string)
ImgLayer2 = sys.argv[2]
ImgLayer3 = sys.argv[3]

ExtentInYMax = sys.argv[4]
ExtentInYMin = sys.argv[5]
ExtentInXMax = sys.argv[6]
ExtentInXMin = sys.argv[7]

df1 = arcpy.mapping.ListDataFrames(mxd)[1]

newExtent = df1.extent
newExtent.XMin, newExtent.YMin = ExtentInXMin, ExtentInYMin
newExtent.XMax, newExtent.YMax = ExtentInXMax, ExtentInYMax
df1.extent = newExtent
layers1= ListLayers(df1)

for layer in layers1:
   restLayer = "rest - "+layer.name;
   if restLayer == ImgLayer1:
      layer.visible = True

You can then turn layers on/off(Or add them from an outside location if possible), change extent etc. of each dataframe.

Check the documentation at http://desktop.arcgis.com/en/arcmap/10.6/analyze/arcpy-mapping/convertwebmaptomapdocument.htm

0 Kudos
by Anonymous User
Not applicable

Thanks!

MARGARET GENZER

GIS Technician

3421 Paesanos Parkway

San Antonio, TX 78231

O: (210) 979-8444 ext 850

TBPE Firm #9513 / TBPLS Firm #101223-00

Website<http://www.kfwengineers.com/> | LinkedIn<http://www.linkedin.com/company/kfw-engineers-&-surveying> | Facebook<http://www.facebook.com/kfwengineers> | Twitter<http://www.twitter.com/kfwengineers> | Instagram<http://www.instagram.com/kfwengineers>

CONFIDENTIALITY NOTICE: This e-mail and any files transmitted with it are confidential and are intended solely for the use of the individual or entity to which it is addressed. This communication may contain protected or privileged material and should only be viewed by the intended recipient(s). Any unauthorized review, printing, retention, copying, disclosure, distribution, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is strictly prohibited. If you have received this email in error, please notify us immediately by return email and delete the document. KFW Engineers & Surveying, its subsidiaries and/or its employees shall not be liable for the incorrect or incomplete transmission of this e-mail or any attachment, or responsible for any delay in receipt. Thank you for your cooperation.

0 Kudos