Publishing a geoprocessing service to work with AGOL feature services(?)

5110
11
12-29-2015 01:17 PM
CharlesBailey3
Occasional Contributor II

I have a geoprocessing service on our arcgis server that is shared to our AGOL organizational account. I am trying to use the URL for this service to create a Geoprocessing widget in WAB 1.2 developer version. Although it does drop down the layer list for the web map and allows the selection in the widget dialogue, it will not execute and throws a generic 'failed' error. I even tried to put in the url for one of our feature services as a constant value with same result. BTW this is just a service from the Add Geometry Attributes tool to get the updated area of edited features, and if anyone knows a better way to do this please let me know. Thanks very much, cob

0 Kudos
11 Replies
AravindStoryMaps
Esri Regular Contributor

Can you change the message level of the geoprocessing service from "None" to "Info" in the properties of the GP service in Server Manager and try to run the tool again?

0 Kudos
CharlesBailey3
Occasional Contributor II

Hi Aravind, thanks for the reply. When I changed the message to info in the

arcserver, here's what I got:

So I changed the desired geometry field to add to 'area_geodesic' and then

got this message:

Submitted.

Executing...

Executing (Add Geometry Attributes): AddGeometryAttributes "Feature Set"

AREA_GEODESIC FEET_US ACRES

PROJCS['USA_Contiguous_Albers_Equal_Area_Conic_USGS_version',GEOGCS['GCS_North_American_1983',DATUM['D_North_American_1983',SPHEROID['GRS_1980',6378137.0,298.257222101]],PRIMEM['Greenwich',0.0],UNIT['Degree',0.0174532925199433]],PROJECTION['Albers'],PARAMETER['False_Easting',0.0],PARAMETER['False_Northing',0.0],PARAMETER['Central_Meridian',-96.0],PARAMETER['Standard_Parallel_1',29.5],PARAMETER['Standard_Parallel_2',45.5],PARAMETER['Latitude_Of_Origin',23.0],UNIT['Meter',1.0]]

Start Time: Wed Dec 30 11:49:05 2015

Executing (Add Geometry Attributes): AddGeometryAttributes "Feature Set"

AREA_GEODESIC FEET_US ACRES

PROJCS['USA_Contiguous_Albers_Equal_Area_Conic_USGS_version',GEOGCS['GCS_North_American_1983',DATUM['D_North_American_1983',SPHEROID['GRS_1980',6378137.0,298.257222101]],PRIMEM['Greenwich',0.0],UNIT['Degree',0.0174532925199433]],PROJECTION['Albers'],PARAMETER['False_Easting',0.0],PARAMETER['False_Northing',0.0],PARAMETER['Central_Meridian',-96.0],PARAMETER['Standard_Parallel_1',29.5],PARAMETER['Standard_Parallel_2',45.5],PARAMETER['Latitude_Of_Origin',23.0],UNIT['Meter',1.0]]

Start Time: Wed Dec 30 11:49:06 2015

Running script AddGeometryAttributes...

Completed script AddGeometryAttributes...

Succeeded at Wed Dec 30 11:49:06 2015 (Elapsed Time: 0.21 seconds)

Succeeded at Wed Dec 30 11:49:06 2015 (Elapsed Time: 0.24 seconds)

Failed.

Could not service request.

As far as the layer list in the widget dialog I did exactly what you

described in the desktop scenario. In the widget config I selected 'user

defined' input instead of choice list or draw tool. When choice list is

selected the tool operates on the data that is copied to the server when

the service is published, which is no use to us. I want to try your model

method but I don't quite understand about the static layer that the tool

operates on - isn't that why you set the input parameters in the model? If

necessary it would be ok to have a pre-set layer to operate on but it needs

to be one of our feature services in AGOL - and I'm not quite sure how to

set that up - with the URL? I already tried to set a constant value URL in

the widget pointing to one of our services but that didn't work either gave

a similar long winded error like it succeeded but then failed at the end.

Can you tell anything about what is going on from these messages? Thanks

again, cob

0 Kudos
AravindStoryMaps
Esri Regular Contributor

Hi Charles,

Thanks for the reply! I think the .png file you have attached did the trick. It seems like the GP service you run doesn't seem to apply for the parameter for AREA_GEODESIC for the data that you have chosen from the web app. Every data/layer has a different set of parameters to plug into for the AddGeometryAttributes tool.

Is there a model parameter for selecting the members of AddGeometryAttributes like "Area", "Length", "Centroid", etc? This might help. However, I would like to know about how you setup the GP service.

0 Kudos
CharlesBailey3
Occasional Contributor II

There are all of those parameters listed in the second error message (the one copied and pasted) but the only ones I was selecting were 'area' and 'perimeter length'. After the first error message (attached png) I changed the selected parameter to 'area_geodesic' and got the second error message. All I did to set it up was run the tool in desktop on a dataset similar to the feature service (it would not run on the actual service in the map, failed with error) which was basically a local copy of the service projected to Albers so it would let me select 'area' and 'perimeter length' in the checklist. I then shared the results from desktop as a service by connecting to our arcgis server, and put the url from this published service into the GP widget config dialog. I actually did this before the service was shared to AGOL but it didn't make any difference which method I used. I think it actually worked one time before I shared it to AGOL but the data was coming from a version copied to our server instead of the AGOL feature service - at least I think that's where it was coming from. At that time it created a temporary layer as an operational layer in the layer list, but as I said it wasn't operating on the data our users will be editing. The whole point is to be able to update area calculations after the users edit - like cutting polygons, etc. Did the model builder method you describe allow you to add fields and calculate geometry for a selected feature service in the app? Thanks, cob

0 Kudos
AravindStoryMaps
Esri Regular Contributor

Hello Charley,

I have a couple of questions on your workflow:

1. I ran the AddGeometry Attributes tool in Desktop to a feature class.

2. Opened the results window and published the result as a GP service to ArcGIS Server.

3. Brought that URL in and shared it to my ArcGIS Online account.

4. Used that as an item in the GP widget in WAB 1.2 developer version.

5. While editing the item details, I cannot seem to select or make the tool show up the layer list of the web map or have it as a selection in the dialog as you have mentioned.

For that to appear, did you have a model built in ModelBuilder? There seems to be a step that I am missing here.

But here's a workflow I would recommend.

1. Build the following model in ModelBuilder.

2. This is how the tool would like:

3. You can add Length and Area units if you would like as model parameters in order to show up.

4. Run the model with a data input in Desktop.

5. Share the result as GP service in Server and share it to ArcGIS Online.

NOTE: You will now note that it doesn't display all of the layers in the layerlist in the web app developer version now. Geoprocessing services are designed to only work on a specific output schema, i.e. if you choose a point as the input in the tool and run the model, it gives out an output point schema. This makes it unchangeable and cannot be made dynamic in the web app based on what input you provide. Therefore, if you have a polygon input in the WAB, the symbology will be hard to display since drawing a polygon as a point isn't very effective.

0 Kudos
CharlesBailey3
Occasional Contributor II

Looking at my reply I should have mentioned the first error message is the attached image, which occurred when I requested the area field be added. I noticed when I ran the tool in desktop that when I selected the local copy of our AGOL feature service to run the tool on, it would not allow the selection or area or perimeter length even though the data is in WGS84 Web mercator auxiliary sphere which is a projected CS, correct? So that's why I requested area-geodesic in the second attempt even though I didn't think it made any sense. Have you actually been able to get this to work (i.e. add and calculate fields) for a feature service in AGOL? Thanks very much, cob

0 Kudos
AravindStoryMaps
Esri Regular Contributor

The following are my GP service model parameters and how the model looks in Desktop. I was able to get the service to work in WAB 1.3 developer version.

GP widget parameters:

1. Input - (notice i have "selecting layer from the map")

2. Geometry properties - (I think this window might be missing for you)

3. Temporary output written on top of the input data

How the model looks in Desktop in ModelBuilder

1. Add a "Feature Set" variable into modelbuilder.

2. AddGeometryAttributes tool is dragged into it.

3. Right click on the tool and click "Make Parameter by value - Geometry properties".

4. Add a sample feature layer into the "Feature Set" variable.

5. Select a geometry property to be added as attribute.

6. Go ahead and run this tool.

7. Share the result as GP service. Under parameters, look for the name of the "feature layer" and choose "Choice list".

8. Publish the GP service.

9. Modify the GP widget according to the three pictures from top.

10. Run the tool.

Let me know if that works!

0 Kudos
CharlesBailey3
Occasional Contributor II

OK I'll try it and let you know. Thanks a bunch Aravind! cob

0 Kudos
AravindStoryMaps
Esri Regular Contributor

No worries! Have a happy new year!

0 Kudos