Select to view content in your preferred language

No result when executing a custom web tool in ArcGIS Online that was created with a notebook

233
3
08-15-2024 07:26 AM
Labels (1)
SebastianAnders
Emerging Contributor

Hello everyone,

I have tried to change the workflow of the following tutorial to the German area.

New! Notebooks as Web Tools in ArcGIS Online (esri.com)

When I run my script in the notebook, I get the desired results. Furthermore I can publish the notebook as a webtool and run it in ArcGIS Online without any error message. The webtool also runs, but unfortunately no results appear on the map. No error message appears in the webtool history either.

Without an error message, it is difficult to see why the tool and the script behind it are not generating any output.

Is there a way to call up a more detailed history of the tool that has already been executed to see whether no output has actually been generated?

A short explanation of my Workflow:
I have changed the coordinates of the input points as well as the name so that they represent German cities. The workflow to generate the route is the same as in the tutorial above. The route is also generated. I can plot it in the Notebook as a LineString. The geometry is not empty and is valid. It is also possible to convert it into a FeatureSet and the output of the route as a dictionary is entered as a default in the parameter window, when creating the output parameters.

SebastianAnders_0-1723731226091.pngSebastianAnders_1-1723731289877.png

SebastianAnders_6-1723731849648.png

 

Even if the workflow changes from now on, as a different data set is used for electric charging stations, I end up with a FeatureSet with points (charging stations) around the route. I have also entered the dictionary of the charging stations as default in the parameter window.

SebastianAnders_2-1723731364800.png

 

SebastianAnders_3-1723731399838.png

 

SebastianAnders_5-1723731574525.png

 

I have added the codes to create the output parameters at the end of the script. I checked if the variables fit to the code from the parameters.

SebastianAnders_4-1723731442509.png

 

Publishing the tool worked and I was able to run it in MapViever with two points in different layers.

The tool runs without error message, but no result is created.

What could be the reason for this? 

It seems like the tool in ArcGIS Online does not recognize the Output Parameters, because both FeatureSets won't show on the MapViewer.

When i open the history tap of the executed Task and click on the parameters ribbon, only the input-parameters show. Is that a problem? Should there also be output-parameters? 

SebastianAnders_7-1723731975365.png

SebastianAnders_8-1723731997948.png

 

If any of you could help me or need further information from me, please contact me. 

Thank you very much and kind regards

Sebastian



0 Kudos
3 Replies
SebastianAnders
Emerging Contributor

Sadly i could not find a solution yet.

But maybe it is because of the FeatureSet or the dictionary behind the FeatureSet. 

Which keys does the FeatureSet need to have? 

Right now dictionary with a "feature":[] and a list of features. The feature look like this: 

 

{
			"geometry": {
				"spatialReference": {
					"wkid": 3857
				},
				"x": 980502.6314999983,
				"y": 6998179.386699997
			},
			"attributes": {
				"x": 980502.6314999983,
				"y": 6998179.386699997,
				"OBJECTID": 2
			}
		}

each feature has a "x" and "y" attributes, because the sdf i created earlier had columns with these values and a SHAPE column.

Does each feature need a geometryType field or something else? 

 

After the Features there are some other keys with values in the dictionary of the FeatureSet:

"objectIdFieldName": "OBJECTID",
	"displayFieldName": "OBJECTID",
	"spatialReference": {
		"wkid": 3857
	},
	"geometryType": "esriGeometryPoint",
	"fields": [
		{
			"name": "x",
			"type": "esriFieldTypeDouble",
			"alias": "x"
		},
		{
			"name": "y",
			"type": "esriFieldTypeDouble",
			"alias": "y"
		},
		{
			"name": "SHAPE",
			"type": "esriFieldTypeGeometry",
			"alias": "SHAPE"
		}
	]

Maybe that information helps to find the mistake in my Script. 

Thank you very much!

0 Kudos
xlt208
by Esri Contributor
Esri Contributor

Hi @SebastianAnders,

Thank you for posting here and providing the details!

When troubleshooting notebook web tools, I've found it helpful to leverage the browser's built-in developer tools, particularly for examining console errors and monitoring network traffic.

With a web tool that outputs the same FeatureSet (stations) you provided above, I see the same behavior where the tool completes without error while the FeatureSet is not displayed on the map. I also see an error in the console: "objectIdField not set and couldn't be found in the provided fields", which indicates the Object ID field is missing in the field list.

Therefore, I appended "OBJECTID" to "stations.field" using the following code. Here is a notebook demonstrating the adjustments: https://www.arcgis.com/home/item.html?id=9f1f48eb033c4121acadf526aedca177.

stations.fields.append({
"name": "OBJECTID",
"type": "esriFieldTypeOID",
"alias": "OBJECTID"
})

Then, I saved the changes to the notebook and overwrote the web tool. As a result, the FeatureSet output now appears on the map.

xlt208_0-1725644972171.png

Could you try appending the Object ID field to your "stations" object as well? Please let me know how it goes or if you have any questions! 

 

Best,

Lingtao

Product Engineer for ArcGIS Notebooks

0 Kudos
SebastianAnders
Emerging Contributor

Hi Lingtao,

it works! 

it looks like the FeatureSet just needed an Object ID-field! 

thank you very much for your time an your solution. You helped me a lot!

Kind regards,

Sebastian

 

 

 

0 Kudos