do you mean nothing is produced?
do you get errors?
does it work manually with the inputs you tried in the model?
or is it one of these bugs
Thanks for the quick reply! Sorry my response is delayed. I have had a busy weekend. I don't appear to get any errors and nothing is produced. I'm not experiencing any of the bugs listed on that page. It does work if I open the model in edit mode and execute it from there; however, if I run it as a tool while passing input and output arguments nothing is produced. I could attach the model if that would help?
Lance - I mirrored your workflow and saw that the *.kmz does not get written at all. I thought it may have to do with the Make Feature Layer GP tool. I removed the Make Feature Layer GP tool and just used the Layer to KML GP tool by itself. Ran the model and output is created. If you want to make a variable from a parameter for the input the "Layer" parameter, you can. Then you get pick an input layer each time you run the model. Hope this helps.
Thanks for recreating it! I've set it up to use the feature layer instead and it did work in ArcGIS Pro. What I am actually trying to do is take this model and turn it into a script tool that then is published as a geoprocessing service that is embedded in the geoprocessing widget through WAB. I'm running into an issue when I execute this tool through WAB though. It looks like the error is saying I am not providing a valid input to the LayerToKML call, but I can not understand why. I can publish this exact same script through ArcMAP and it works fine. I've included the error below along with the script. Is there any chance you know what is going on? (Sorry I'm not sure how to attach files through here or if it is even possible)
One thing that comes to mind based upon it working in ArcMap and not from ArcGIS Pro is that Python versions between ArcMap (2.7) and ArcGIS Pro (3.6.9) is very different. I'd recommend running the "Analyze Tools for Pro" GP tool in ArcGIS Pro for your current Python script to see if it returns any error messages in the output text file. If so, then you'll need to update your Python script for AGP to work with it.
Thanks for the suggestion. I did run that and no error came back. I should back up and correct my above comment. Basically if I run the below code in ArcMAP or Pro it will execute fine on my desktop. However, when publish this as a GP services from both ArcMAP and Pro it will fail when I run it through the WAB Geoprocessing widget.
However, if I include arcpy.MakeFeatureLayer as the first step, prior to calling arcpy.LayerToKML it will run fine on ArcMAP and when I publish as a GP Service from ArcMAP it executes appropriately through the WAB Geoprocessing widget and the KMZ is created on the server. If I execute this through Pro it executes successfully as far as not failing goes, but it does not produce the KMZ just as you pointed out above. I went ahead and published it even though it did not produce the KMZ in hopes that it would work on ArcGIS Server. However, when I executed it through the WAB Geoprocessing widget it does not fail, but the KMZ is not produced just like when I ran it in Pro. I will include the code below that works when I do everything through ArcMAP.
I'm thinking that the layer file can be created successfully in memory using the 2.x version of python that ArcMAP uses, but it can't be created with the 3.x version that Pro uses. I feel like when it gets on the ArcGIS server the version of python used must be somehow connected to which client it was published from. Any thoughts? Could this just be a bug?
Interesting. I do see two DEFECTS on the Esri Internals that "may" be related:
Now the reason I think related is it seems KMZ is not supported in the Add Data widget which leads me to think perhaps KMZ is not supported in WAB. If that's true, then the GP service you're running may not be able to create the KMZ to begin with and zero features from the GP service.
I'd recommend reaching out to Esri Support Services to see if they can do a deeper dive on this issue.
Thanks I figured I would need to do that. But just to finish off this thread neither of those two defects should be at play here since all of the code is running on the server side which has access to everything it needs to produce the KMZ file. I can author and publish the script/tool in ArcMAP and execute it through WAB Geoprocessing widget without any issue. The KMZ file is produced and stored in the scratch jobs folder that I can then send back to the user via a URL.
I feel confident that the issue must reside with ArcGIS Pro and it's use of the arcp.MakeFeatureLayer function. As I have tested, the output of this function doesn't seem to feed into the arcpy.LayerToKMZ function appropriately like it does when I do the exact same workflow through ArcMAP. I don't know for sure, but I feel like when I publish from Pro it alerts the server to use the 3.x version of python that may be causing the issue. This could also be due to the new layerfile type in Pro, but I am not certain. ".lyrx" in ArcGIS Pro vs ".lyr" in ArcMAP see LayerFile—ArcPy | Documentation.
I will open a case with tech support and see if they can assist, but if you have any more ideas feel free to throw them back at me!