Select to view content in your preferred language

Geoprocessing+Python+Flex. Problems galore!

2073
5
05-03-2010 05:36 PM
seanlo
by
Emerging Contributor
Hey everyone!

My current task and a quick background: create a model to do weighted overlay, publish that model on the internet. That model must have UI-slider bars to choose the scaled values, and the RASTER result should be draw on the flex application.

Turns out the weighted overlay takes in a table.. and you can't pass a table through the web.

Summary: I write it so the python script takes in a string, so the flex application would basically just pass it a whole bunch of strings. The python splits them up and processes it, passes it into the weighted overlay process(in python), and voila, adds the RASTER result on the map.

The whole process runs successfully. HOWEVER, the results are not displayed on the web. It displays fine on the desktop level, but not on flex.
The raster files are generated on the server's local drive when i run the geoprocessing services through flex.

Anyone have any ideas?

Thanks!
Sean.
Tags (2)
0 Kudos
5 Replies
HessCorporation
Emerging Contributor
I don't think web clients will take rasters as an output from geoprocessing, you can either set up the gp service to output a result map service or convert the raster into a featureset and then parse the values within your flex app to color them as desired.

Edit* Yup, rasters are supported an output for ArcGIS desktop but not explorer or web clients...
http://help.arcgis.com/en/arcgisserver/10.0/help/arcgis_server_dotnet_help/index.html#/Input_and_out...

But i agree, geoprocessing and web clients is enough to give any sane person an aneurysm, add raster geoprocessing to that and it gets even more annoying, i tried something similar with a kernel density tool and ended up writing the whole geoprocessing process within a flex module using a BitmapData class.
0 Kudos
seanlo
by
Emerging Contributor
Ok Problem solved!

We used a raster dataset instead. Everything works beautifully, and processing time was cut from 10 mins to less than 1.
0 Kudos
mattijnvan_hoek
Emerging Contributor
Ok Problem solved!

We used a raster dataset instead. Everything works beautifully, and processing time was cut from 10 mins to less than 1.


Hello Sean,
I'm about to start the same project as you have been working on. The use of the weighted overlay tool on 4 raster datasets that will produce a new raster based on the different weightings. Standard procedure in ArcGIS Desktop, but as you mentioned, problematic within a web (Flex) application.
- Input needs to be a string representation
- Output can be raster, by using a result map service

Firstly, my question to you is how you have converted the raster datasets into a string representation, so it can be used as input for the weighted overlay? (just by using calculate value tool?)
Secondly, I thought that the string representations can be processed to raster layers (calculate value tool) and then can pass into the weighted overlay tool, but you mention that you've written the process in Python. Hopefully you can explain a little bit more of your best practices.

email: m.vanhoek@cranfield.ac.uk
0 Kudos
FabianoScardua
Emerging Contributor
Can you explain your solutions?
0 Kudos
mattijnvan_hoek
Emerging Contributor
Can you explain your solutions?


If you mean me, than I can tell a little bit more about the things what I've done so far:

Firstly found out the string representation of a Weighted Overlay Table
For Weighted Overlay Table is the string representation:
CatalogPath of Raster Layer - Influence - Remap
e.g. "(C:\inetpub\wwwroot\ArcGIS\SHAREDDATA\Geoprocessing\subsidence 0.25 VALUE 1 1;2 2;3 3;4 4;5 5; C:\next_raster)1 9 1"

By setting this as input for a string and using it as expression in the Calculate Value tool is it possible to create the datatype Weighted Overlay Table, this feeds into the Weighted Overlay Tool.
I have split up the string representation so I can make from the string that represent the influence a Parameter (in my case 'InfluenceSubsidence')
e.g. "(%PathSubsidence% %InfluenceSubsidence% %RemapSubsidence%; %next_raster%)1 9 1"

I've set the output of the Weighted Overlay Tool as a Parameter as well, so now I've a model that has string inputs that can set the influence for the weighted overlay tool and I've one output that is a Raster Layer.

Drag only the model to the TOC (output will appear as well), save the mxd and publish this to the ArcGIS Server.

Now you have a geoprocessing service running that works on the web, that has string representation as inputs for the Raster Layers and Weighted Overlay Table and can spit out a Raster Layer by using a Result Map Service.
I've test it in ArcGIS Services Directory and it works quickly. At the moment I'm working on a simple Widget with the ArcGIS Flex API to change the influences, but I've no experience with this, so this can take a while.
Good luck
0 Kudos