I have generated a .gpkx package using a custom tool that accepts a .lyr file as input and produces a layer as output. The tool runs successfully in ArcGIS Pro, and the .gpkx is created without any issues. However, when attempting to use the .gpkx in my WPF application through a local runtime server, the GeoprocessingJob encounters failures. Can anyone provide insights or suggestions on resolving this issue?
Actually I want to display Layers from .lyr file in my WPF application using ArcGIS Maps SDK.Net but as there is no direct way to load .lyr file in Maps SDK so I am trying to create a .gpkx to load layer using Local Server.
Follwoing is arcpy code from which .gpkx was generated
import arcpy
import os
def script_tool(inputlyrfile, inputprojectpath, outfolderpath, outputlyr):
arcpy.env.workspace = outfolderpath
projName = "mmpkproject"
projNamewithPath = os.path.join(outfolderpath, f"{projName}.aprx")
outmpkxfilepath = os.path.join(outfolderpath, "mpkxpackagefile.mpkx")
aprx = arcpy.mp.ArcGISProject(inputprojectpath)
newMap = aprx.createMap("mmpkmap", "Map")
insertLyr = arcpy.mp.LayerFile(inputlyrfile)
newMap.addLayer(insertLyr)
insertLyr.saveACopy(outputlyr)
del aprx
return
if __name__ == "__main__":
inputlyrfile = arcpy.GetParameterAsText(0)
outfolderpath = arcpy.GetParameterAsText(1)
inputprojectpath = arcpy.GetParameterAsText(2)
outputlyr = arcpy.GetParameterAsText(3)
script_tool(inputlyrfile, inputprojectpath, outfolderpath, outputlyr)
===============================================
Following are input/output parameters set in Tool properties
In my WPF application I am following the ArcGIS Maps sdk sample to consume the .gpkx using Local Server but GeoprocessingJob is failing.
I have generated a .gpkx package using a custom tool that accepts a .lyr file as input and produces a layer as output. The tool runs successfully in ArcGIS Pro, and the .gpkx is created without any issues. However, when attempting to use the .gpkx in my WPF application through a local runtime server, the GeoprocessingJob encounters failures. Can anyone provide insights or suggestions on resolving this issue?
Actually I want to display Layers from .lyr file in my WPF application using ArcGIS Maps SDK.Net but as there is no direct way to load .lyr file in Maps SDK so I am trying to create a .gpkx to load layer using Local Server.
Follwoing is arcpy code from which .gpkx was generated
import arcpy
import os
def script_tool(inputlyrfile, inputprojectpath, outfolderpath, outputlyr):
arcpy.env.workspace = outfolderpath
projName = "mmpkproject"
projNamewithPath = os.path.join(outfolderpath, f"{projName}.aprx")
outmpkxfilepath = os.path.join(outfolderpath, "mpkxpackagefile.mpkx")
aprx = arcpy.mp.ArcGISProject(inputprojectpath)
newMap = aprx.createMap("mmpkmap", "Map")
insertLyr = arcpy.mp.LayerFile(inputlyrfile)
newMap.addLayer(insertLyr)
insertLyr.saveACopy(outputlyr)
del aprx
return
if __name__ == "__main__":
inputlyrfile = arcpy.GetParameterAsText(0)
outfolderpath = arcpy.GetParameterAsText(1)
inputprojectpath = arcpy.GetParameterAsText(2)
outputlyr = arcpy.GetParameterAsText(3)
script_tool(inputlyrfile, inputprojectpath, outfolderpath, outputlyr)
===============================================
Following are input/output parmeters set in Tool properties
In my WPF application I am following the ArcGIS Maps sdk sample to consume the .gpkx using Local Server but GeoprocessingJob is failing.