0

So I'm trying to have users export a JPEG of an area. I'm just in the beginning stages of doing this. I'm stuck on why the features from the MXD are not showing up on the output of the GP tool.

I created a MXD with counties on it. Published the MXD to ArcGIS Server with the counties on it. Registered the layers in the MXD to the Server.

I created a simple Python script that exports the MXD into a JPEG. Works on Local Machine. Published it to ArcGIS Server. When running the GP Service in WAB it only exports the MXD with no layers in it.

What am I missing here? I don't seem to have any features on the exported JPEG. It's just blank.

Python code:

import arcpy, os, zipfile, shutil, urllib2

arcpy.env.overwriteOutput = True
outFolder = arcpy.env.scratchFolder


jpgFile = os.path.join(arcpy.env.scratchFolder, "test" +".jpg") 
outPutLocation = arcpy.SetParameterAsText(0, jpgFile )

mxdPath = r"xxxxxxxxxxxxxxx\xxxxxxx\xzxxxxxxx\xxx.mxd"



mxd = arcpy.mapping.MapDocument(mxdPath)
df = arcpy.mapping.ListDataFrames(mxd, "Layers")[0]
arcpy.mapping.ExportToJPEG(mxd, jpgFile)
arcpy.AddMessage(jpgFile)
0

Can you use the print widget instead of a custom GP tool? In WAB use the Print Widget and point the URL to your print service task on your GIS Server. In your GIS Server, navigate to the PrintingTools GP Service under Utilities. Click 'Export Web Map Task' and copy paste the URL into the WAB Print Widget

enter image description here

  • Well what I want to do is a little more complex. The goal will be a users selecting an area by a input SQL expression. Then when the users submits the expression "County = "Washington"" The GP tool on the server will open the MXD then zoom to that location + do other queries on different layers in that mxd. Seems like this would be possible with a GP Service – AdamGIS Nov 23 '20 at 21:21

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.