Select to view content in your preferred language

Get "Tabulate Area" to work from a Geoprocess using Model Builder

3063
5
06-07-2010 01:14 PM
James_H_Cutts_III
Emerging Contributor
I am attempting to build a model that will be published as a Geoprocessing service on a ArcGIS Server 9.3.1. The service will be called from a Flex application. I've got the Flex part down. I can call several other models from the Flex application.

Here's the basic model:

When I initially setup the model, it ran nicely. Although it only worked for the specific predefined county I included in the map for building and testing the model. When finished the "Boone_County" will be passed to the model as an area defined in the Flex app.

The next changes I made to the model were to change the data type of "Boone_County" from a "Composite Geodataset" to a "Feature Set" and made it a parameter so I could pass into the model the area from my Flex app. I also made the "Tabulat_Export_1" a parameter so I could see the results.

Since "sde.SDE.Option_1" is map specific, I dragged the model to the map, and saved the map. I copied the map and toolbox to my ArcGIS server and published the map. The map and GPService were both successfully started.

I go to my Flex application and call the GPService and receive the infamous faultCode=500 errormessage
[INDENT][FaultEvent fault=[RPC Fault faultString="Error Executing Task" faultCode="500" faultDetail=""] messageId=null type="fault" bubbles=false cancelable=true eventPhase=2][/INDENT] which generally means something didn't work, but we don't know what.

I have learned that I can go to the \ArcGIS\Server\user\log directory and look up additional information on some of the faultCode=500 errors. Here's what I got:
[INDENT]<Msg time="2010-06-07T16:06:57" type="ERROR" code="20010" target="BioMass/BioMass_Raster_1.GPServerSync" methodName="GPServerSync.CheckMessages" machine="hoth" process="8672" thread="6212">Executing (BioMass_Tabulate_1A_V0): BioMassTablulate1AV0 "Feature Set" E:\Projects\BioMass\Tabulat_1 Start Time: Mon Jun 07 16:06:57 2010 Executing (Tabulate Area): TabulateArea "Feature Set" CNTYIDFP sde.SDE.option_1a Value E:\Projects\BioMass\Tabulat_1 10 Start Time: Mon Jun 07 16:06:57 2010 ERROR 999999: Error executing function. Failed to execute (Tabulate Area). End Time: Mon Jun 07 16:06:57 2010 (Elapsed Time: 0.00 seconds) Failed to execute (BioMass_Tabulate_1A_V0). End Time: Mon Jun 07 16:06:57 2010 (Elapsed Time: 0.00 seconds)</Msg>
[/INDENT]
It is simply saying that "Tabulate Area" didn't work, but fails to tell me why. Anyone have any suggestions?
0 Kudos
5 Replies
KevinHibma
Esri Regular Contributor
James,

Its a little tricky to pin point exactly what went wrong, but you provided a great explanation. A couple things for you to check and be sure of:

-make sure you set relative paths within your model properties
-I'd suggest using %scratchworkspace%\tableoutput as the output (or substitute tableoutput with your results name, but use %scratchworkspace%)
-Your comment on bringing the model/map over to the AGS machine - do you have desktop there? If so you can just re-run it for a quick test (if not, no problem), just ensure you drag over everything (easiest if kept in the same folder):
---tbx
---mxd
---output data
---data used as reference for the featureset
-and the sde data: sde.sde.option_1a - is this coming right from SDE, (featureclass) or is it pulling from the map (feature layer)? If its the featureclass you may want to make a copy of the SDE connection string (.sde file), and save it to your working directory. Then reference it from that path - not from the SDE Connection node.

Like I said, I'm unsure exactly where its failing, but any one of the above things could just fix it. Hopefully this moves you forward.
0 Kudos
James_H_Cutts_III
Emerging Contributor
Kevin,
Thanks for the pointers. 

I was using absolute paths but fortunately, both machines have the same directory structure.  The "E:\Projects\BioMass" directory exists on both my development machine and the production server.  I've replaced the absolute path with "%scratchworkspace%" for the output.

I do have ArcMap on the production server and everything works perfectly there.

The sde.SDE.option_1a is a (feature) layer in the map.

I believe I may have identified the problem but as of yet I haven't figured out how to test it in the Flex application. I know the following will cause a problem when run from the desktop.

In the desktop, when I am adding features interactively, I can add a feature by clicking on the map to define a polygon area.  However, if I fail to add a value in the "CNTYIDFP" column (See below)  the model will die with an error 999999.


I have identified that this is because the TabulateArea tool requires a value in the "Zone Field". (See the definition of the tool below.)


I am hoping that if I can figure out how to get Flex to add a value identified as "CNTYIDFP" to the polygon that I'm passing to the model then everything will work.  (Fingers crossed)  I've post the "how-to" question in the ArcGIS API for Flex forum.  Let's hope I can get an answer from there and can get this project finished.  If you have any contacts in the Flex API area of ESRI you might pop them a note that there's a question pending. 

Thanks.
0 Kudos
KevinHibma
Esri Regular Contributor
James,

Excellent - I'm glad you got it narrowed down.
While I'm not a Flex Guru, I suspect there will be two ways to solve your problem. Both of when you could model after the concepts on the "Viewshed Flex Geoprocessing" page:
http://help.arcgis.com/en/webapi/flex/help/content/inside_api/geoprocessor.htm

This example works very similar to yours, in that a feature set and a value is required as input.
You can either create a text box and have the user define the value, or you can hardcode it and pass it at execution.
The only major difference I suspect is instead of passing the value as its own parameter, I believe it needs grouped in with the featureset.

I dont know the exact Flex code, but you can see from this JSON request how the values for "FID" and "ID", which are values in the FeatureSet table are passed along with the geometry. So I guess that leads you back to how to pass these values in your Flex application.
{"features":[{"attributes":{"FID":1,"Id":1,"Shape_Length":0,"Shape_Area":0},"geometry":{"rings":[[[{{LoadTestDB.GP_REST_Execute_Demographics_400.pt_x1}},{{LoadTestDB.GP_REST_Execute_Demographics_400.pt_y1}}],[{{LoadTestDB.GP_REST_Execute_Demographics_400.pt_x2}},{{LoadTestDB.GP_REST_Execute_Demographics_400.pt_y2}}],[{{LoadTestDB.GP_REST_Execute_Demographics_400.pt_x3}},{{LoadTestDB.GP_REST_Execute_Demographics_400.pt_y3}}],[{{LoadTestDB.GP_REST_Execute_Demographics_400.pt_x4}},{{LoadTestDB.GP_REST_Execute_Demographics_400.pt_y4}}],[{{LoadTestDB.GP_REST_Execute_Demographics_400.pt_x5}},{{LoadTestDB.GP_REST_Execute_Demographics_400.pt_y5}}]]],"spatialReference":{"wkid":4326}}}]}


....just ignore the "loadtestdb", and imagine those were actual XY values
0 Kudos
James_H_Cutts_III
Emerging Contributor
Kevin,
Thanks for the feedback. Dasa Paddock provided the answer I needed in the forum thread 'Add "Fields" to Polygons for passing to Geoprocess' to the question of how to add the necessary field.

I have cleaned up the model implementing your suggestions and renaming things to make more contextual sense.


The next phase of the project is to setup this model for each of 16 different rasters (OPTION_1A through OPTION_4D). I haven't figured out how to make OPTION_1A a variable that I can pass from outside of the model, so I decided to make 16 copies of the model. (It's really not that much work, but it would be nice to have the branching in models that is coming soon to an ArcGIS Server 10 near you.)

I am now getting the following error when I attempt to run the above model:
Executing: RasterTabulate1A "Feature Set" E:\Projects\BioMass\BioMass_Scrap.gdb\Tabulate_1A
Start Time: Wed Jul 21 10:00:25 2010
Executing (Tabulate Area): TabulateArea "Feature Set" CNTYIDFP OPTION_1A Value E:\Projects\BioMass\BioMass_Scrap.gdb\Tabulate_1A 10
Start Time: Wed Jul 21 10:00:25 2010
ERROR 010117: Input E:\Projects\BioMass\g_g_g9 does not have an attribute table.
Failed to execute (Tabulate Area).
End Time: Wed Jul 21 10:06:35 2010 (Elapsed Time: 6 minutes 10 seconds)
Failed to execute (RasterTabulate1A).
End Time: Wed Jul 21 10:06:35 2010 (Elapsed Time: 6 minutes 10 seconds)

Since I don't create g_g_g9 there's no way for me to build the attribute table as suggested in the help for the error code. The really annoying thing it that the original model worked, and now the subsequent models don't.

I suppose I could manually build a raster from the Harvest_Area using, I would guess, the "Feature to Raster" tool. But since I have one carefully guarded model that works without going through the "Feature to Raster" process I know that some magical setting of switches, prayers and environmental settings will work.

So my question is: What magical incantation do I need to do prevent this annoying 010117 error reliably?
0 Kudos
James_H_Cutts_III
Emerging Contributor
After working unsuccessfully on this problem a while, I got one of the iterations of the models to work. It would nicely return results in about 4 seconds. However, when I build the next 15 copies of the model, they wouldn't work producing the error messages detailed in my last post.

It was suggested to me that I export the model that worked and one that didn't to Python to let me check what was going on. It was in the Python I found that I had set the Extension to "Union of Inputs" (which was trying to use the entire huge SDE as the extension of the results) in the model that did not work. I changed all the models leave the extension at "Default". I was now able to get the model to work on all 16 models in 7 seconds or less. This was a great improvement on the 16 minutes to error that was happening earlier.

I moved the map and toolbox to my ArcGIS Server machine and tested the 16 models using the copy of ArcMap installed on the server. Everything worked nicely.

I then did all the steps required to publish the map. (I use the ArcGIS Server Manager web interface which has worked nicely.)

  • I published the map.

  • I went to the ArcGIS REST API Admin web tool and cleared the REST Cache.

  • Tweaked my application for the new map and model parameters.

  • Tested my application. It didn't work. 😞

I had forgotten to go into the GeoProcessing Service that is started with the map and change it from Asynchronous to Synchronous.

  • I changed the GeoProcessing Service for the map to Synchronous.

  • I restarted both the GeoProcessing Service and the Map Service.

  • I went to the ArcGIS REST API Admin web tool and cleared the REST Cache.

  • Tested my application. It didn't work. 😞

I started the standard process of debugging a problem by looking at the error message returned. Unfortunately the error message is:
[FaultEvent 
   fault=[RPC Fault faultString="Error Executing Task" 
   faultCode="500" 
   faultDetail=""] 
messageId=null type="fault" bubbles=false cancelable=true eventPhase=2]

I've come to the conclusion that 'faultCode="500"' is ArcGIS Server speak for "I don't know what the heck happened."

As I mentioned in the initial post, I have learned that I can go to the \ArcGIS\Server\user\log directory and look up additional information on some of the faultCode=500 errors. Unfortunately, there's nothing in the log detailing the error. So combining my two sources I have "" and "" for the description of what went wrong. <vent on>Hopefully, ArcGIS Server 10 will have some better error messages. The current error messages suck!</vent off>

I've worked through Preparing map documents containing tool layers help document. No luck.

Per Kevin's suggestions I have tried to use "%scratchworkspace%\Tabulate_1A" for the output destination. Doing this in the ModelBuilder causes ArcMap to crash and disappear from the desktop. Except when I did it to document it for this post.


When I execute the model I get double slashes in the comannd:
BioMassTab1ASub "Feature Set" C:\DOCUME~1\CUTTSJ~1.UMC\LOCALS~1\Temp\\BioMass_Tabulated


So here are the revised questions:

  1. How do I debug an error faultCode="500" when nothing is telling me what is not working?

  2. How do I fix the %scratchworkspace% having a trailing "\"?

0 Kudos