Using WebMap from Organisation in ModelBuilder as Input Map and share Model as Web Tool

1004
11
07-12-2023 01:51 AM
BeckerGIS
New Contributor II

Hey guys,

i have build a Model (named "KML Export"), that allows the user to export selected Objects of Layers to KML-Files.

The Process is: Input Map -- Iterate Layers -- If selection exists -- Layer to KML -- Output

This works totally fine in my local ArcGIS Project, but only than i select my WebMap form my Organisation which i have imported to my local Project.

I shared my Model with one of my Coworkers and he said "Maybe because you referenced a local map from your project". But its technically the same Map(?!). 

When i use the WebMap directly from my organisation as Input Map in my Model with our Organisation URL the Model "turns grey", so all Functions are dead, because the Input Map will not be accepted (?!).

The Thing is, i want to share my Model as a Web Tool for my Organisation in ArcGIS Portal, and then use it as a Widget in a WebApp. So the User can Export KML Files of selected Features directly from the Portal/WebApp.

I tried to share my "totally fine local working model" and i created a Widget with my new Geoprossing Tool "KML Export". I selected my Features and started the export then only "execultion failed" showed up.

I think, it doesnt work because i referenced a local Map form my Project and so i tried to change it to the server connection string (URL) of the Web Map of  the Organisation WebMap, but then the Model doesnt work anymore. 

Do i miss something? Do i have to set my server settings directly in my model? But how? And and do i have to set the Output to "memory" or "in_memory"?

Thanks for your help!

Best regards 

Daniel

Tags (1)
0 Kudos
11 Replies
ShitijMehta
Esri Regular Contributor

Daniel, 
Would you be able to record the error and your steps and share through a video or snapshots?  We would love to help you or atleast figure out if its a limitation/bug.

BeckerGIS
New Contributor II

Hello,

thanks for your reply! 

My Model:

Model.PNG

Here i loaded the WebMap from my Organisation Portal "Grundkarte Zeichentool" in my ArcGIS Pro Project. And use it as InputMap for "iterate Layer". This works fine. If i do not load the WebMap in my local ArcGIS Project and load it directly from the Portal the InputMap will not be accepted (Input Portalelement).

Publish as WebTool:

Publish_WebTool_Contents.PNG

In the publish process as Web Tool, in the Content Configuration Menu i see all my Maps of my current ArcGIS Pro Projects. And i selected "Grundkarte Zeichentool" as default value for the InputMap. This is the Web Map from my ArcGIS Portal that i loaded in my Project and is also the Map i use in my WebApp, there my Widget should be executed.

 

Model as Widget: Configuration Widget in WebApp

Config_Widget_WebApp.PNG

After the successfull publishing of my Model as Web Tool to the Portal. I load it as Widget as Geoprocessing Tool in my WebApp which uses "Grundkarte Zeichentool". In the Options i allowed the User to Export.

Open Widget in WebApp with User Input(Parameter, InputMap)

Tool_in_WebApp_with_InputMap_Parameter.PNG

This is how the Widget looks when i open it in the WebApp. There i can choose the Map as Input and i only see my default value which i choosed in the Publish as Web Tool Process.

Error after executing the Widget:

Error_Output_Portal.PNG

 

After executing the Widget this error showed up. In the ArcGIS Server Manager i can see what happend in the Logs:

ServerLog.PNG

The Log says the required Input, the Map Value, is empty. I think it makes sense, because the Input Map is the Map of my local ArcGIS Project and the Portal does not know this local Map.

I dont thinks its a Bug. I think iam using the wrong input method for the WebMap.

How can i choose the current Portal Map in my Widget? Is there any possibilty to use variables similar to $map in arcade? Or like %currentMap% for the Iterate Layer as Input?

The issue is, i only can publish my model when it runs one time successfully in my arcgis project, and i dont see a option to use portal web maps  directly as input.

I realy hope you can help me. Iam stuck and the only other work around i see is building a Tool in a Python Toolbox.

Thank you!

Best regards

Daniel

0 Kudos
ShitijMehta
Esri Regular Contributor

Thank you so much for this detailed information. I will try this out, but from the looks of it, it might be a bug for us. Will update. Sorry about this issue.

0 Kudos
BeckerGIS
New Contributor II

Thank you! We are using ArcGIS Pro 3.0.2 and i tested it on ArcGIS Server Version 10.8.1 (Build 14362) and also on  ArcGIS Server Version 11.1.0 (Build 42869).

Maybe the Issue can be fixed by an ArcGIS Pro Update?

0 Kudos
ShitijMehta
Esri Regular Contributor

Hi,
Could you please share the model? Looks like the error is with the Layer to KML tool? I want to see what the output path looks like as I see you are using the inline substitution. Please can you also share how big is the data you are passing to Layer to KML Tool? # of rows?
Thank You!

0 Kudos
BeckerGIS
New Contributor II

Yes iam using inline substitution to name my Output KML and Excel (%Folder%\%Layer%_%Value%.kmz), so the Output gets the name of the Input Layer (from iterate Layer) and the timestamp from calculate Time (Tool: calculate value with = Expression: datetime.datetime.now().strftime("%Y%m%d%H%M%S") . Since my last  Screenshot of the Model i changed the name of "Wert" (german for value) to Value. 

"Folder" is the constant Variable for the KML Output. "TrackingFolder" ist the constant Variable for the Excel Output. Both Folders are located on our server.

The number of rows iam passing to Layer to KML  per Layer is limited by the logical tool "if row count is" in my model its called:   "if number less 100". The maximum of rows the User can passing to the Layer to KML Tool is 100.

I created a new Toolbox "esri_Ticket" which contains the model and put it in the attachments.

ShitijMehta
Esri Regular Contributor

I removed the Calculate Value tool and used %t% which adds the current time stamp. %Folder%\%Layer%_%t%.kmz
This is our built in system variable for time. If that is not useful, please ignore this. I removed it as it makes the model simpler to debug. Please could you share why you are checking in selection exists? are the conditions meant to be queued... for example, if the layer in the map has a selection and if the row count is less than 100 then run layer to kml and Table to Excel?

0 Kudos
BeckerGIS
New Contributor II

I didnt know the %t% variable. Thanks, thats nice.

"...for example, if the layer in the map has a selection and if the row count is less than 100 then run layer to kml and Table to Excel?"

Yes, thats exactly what the Model should do. The user should be able to export data form the WebMap based on their individual selection. However, we need to limit the output, both for performance reasons and to maintain visibilty into the data leaving the system. It should not be possbile to export the entire map.

0 Kudos
tahunt01
New Contributor II

I am having a similar issue. I want to publish the Map to KML tool to use in a web application, however it doesn't work in the portal environment. I assume there is a difference between a map and a web map. Are users not able to use their web map as an input to the Map to KML tool?

0 Kudos