Hello everyone,
I need one guidance regarding the utilsiation of task arcpy.ExportWebMap_server.
I want to use this task in one of my geo processing synchrone service. During my unit testing, I publish the following geo processing service:
import arcpy
arcpy.env.workspace="/app/testprint"
WebMapAsJson = arcpy.GetParameter(0)
FormatPrint = arcpy.GetParameterAsText(1)
LayOutTemplate = arcpy.GetParameterAsText(2)
PrintName = arcpy.GetParameterAsText(3)
testPrintCommand = arcpy.ExportWebMap_server(Web_Map_as_JSON=WebMapAsJson, Output_File=PrintName, Format=FormatPrint, Layout_Templates_Folder="", Layout_Template=LayOutTemplate)
When I execute this code through Python installed on server, the code runs and generates a PNG in the folder /app/testprint without any error. Whereas when I publish the geo-processing service, the code returns me the output filename (\\app\testprint\<filename>.png) but no file is generated.
Can anyone please guide me, how can I can make this code works. Any guidance or clue will be useful for me.
Thanks
Solved! Go to Solution.
Hi Neil,
Unfortunatley not. I tried but did not find any solution. Then I implemented my print service through:
result = arcpy.mapping.ConvertWebMapToMapDocument(mapAsJson, templateMxd)
mxd = result.mapDocumentoutputName = 'WebMap_{}'.format(str(uuid.uuid1()))
outputFile = os.path.join(arcpy.env.scratchFolder,outputName)
if fileFormatLower == 'pdf':
## arcpy.mapping.ExportToPDF(mxd, outputFile, resolution = int(dpi))
arcpy.mapping.ExportToPDF(mxd,outputFile)
outputFile = outputFile+".pdf"
So I had to implement for each format. I followed this documentation. ExportToPDF—Help | ArcGIS for Desktop
Hopefully, it will help you
Ayyaz
Hi Ayyaz, Did you ever get to the bottom of this? I'm having exactly the same problems.
Thanks,
Neil
Hi Neil,
Unfortunatley not. I tried but did not find any solution. Then I implemented my print service through:
result = arcpy.mapping.ConvertWebMapToMapDocument(mapAsJson, templateMxd)
mxd = result.mapDocumentoutputName = 'WebMap_{}'.format(str(uuid.uuid1()))
outputFile = os.path.join(arcpy.env.scratchFolder,outputName)
if fileFormatLower == 'pdf':
## arcpy.mapping.ExportToPDF(mxd, outputFile, resolution = int(dpi))
arcpy.mapping.ExportToPDF(mxd,outputFile)
outputFile = outputFile+".pdf"
So I had to implement for each format. I followed this documentation. ExportToPDF—Help | ArcGIS for Desktop
Hopefully, it will help you
Ayyaz