Select to view content in your preferred language

Custom Viewshed Geoprocessing tool inputs

4826
7
Jump to solution
04-12-2012 09:36 AM
Jon-PaulMcCool1
Emerging Contributor
I created my own gp tool to create a polygon viewshed where the user could specify two different input DEMs as well as some visibility options (OFFSETA, OFFSETB, RADIUS1, RADIUS2). While in ArcMap after selecting the point location it is possible to edit the attributes for the chosen point, I do not know how to make this available in the geoprocessing widget. In the widget it is only possible to select from the two DEMs and input a point; the attribute table visible in ArcMap is not there. I have added images and the xml code below. Any help would be most appreciated as this is an important tool for the application and my thesis.
[ATTACH=CONFIG]13460[/ATTACH]

GP Location: http://egis.artsci.uc.edu/ArcGIS/rest/services/PRAGISfull/GPServer/VSProcess

This is the xml code for the gp currently. I do not know how to alter it to add the ability for users to input the necessary visibility options values.
<?xml version="1.0" ?>
<configuration>
    <description/>
    <taskurl>http://egis.artsci.uc.edu/arcgis/rest/services/PRAGISfull/GPServer/VSProcess</taskurl>
    <helpurl>http://egis:8399/arcgis/server/arcgisoutput/PRAGISfull/Model.htm</helpurl>
    <autosubmit>false</autosubmit>
    <inputparams>
        <param type="string" name="Input_DEM" required="true" visible="true" label="Input DEM" defaultvalue="Soils and Elevation\INEGI 1:50000 DEM" tooltip="Select the DEM you would like to use.">
            <choicelist>
                <choice value="Soils and Elevation\INEGI 1:50000 DEM"/>
                <choice value="Soils and Elevation\ASTER DEM Version 2"/>
            </choicelist>
        </param>
        <param type="featurerecordset" name="Input_Observation_Point_s_" geometrytype="point" mode="drawtool" required="true" visible="true" label="Input Observation Point(s)" tooltip="Select desired observation point(s)">
            <renderer type="simple">
                <defaultsymbol type="simplemarker" alpha="1" color="0x3FAFDC" size="15">
                    <outline color="0x000000" width="2"/>
                </defaultsymbol>
            </renderer>
        </param>
    </inputparams>
    <outputparams/>
    <layerorder>Input_Observation_Point_s_</layerorder>
</configuration>
Tags (2)
0 Kudos
1 Solution

Accepted Solutions
AnthonyGiles
Honored Contributor
John-Paul,

I found when implementeing a similar solution the above method did not work as the gp service is not expecting to receive any input parameters for your offset A etc...

So what I did was in the model used the calculate field tool to populate each field value, these can then be set as a model parameter so that the service is expecting to receive the values ( just make sure that you set the Expression type to python otherwise the model will not calculate the fields when published on the server see http://resources.esri.com/help/9.3/arcgisdesktop/com/gp_toolref/data_management_tools/calculate_fiel...)

Hope this helps if you are still having issues

Regards

Anthony

View solution in original post

0 Kudos
7 Replies
AHay
by
Deactivated User
hi
ihave not done any gp models wit h flex viewer yet but from lokking at your config there are only two parameters for your model avail in flex
in the <inputparams> tag
i would assume you would just add what fields you want to have as parameters in a new <param> tag
0 Kudos
Jon-PaulMcCool1
Emerging Contributor
That is what I did. I had no idea it was something so simple ...
0 Kudos
AnthonyGiles
Honored Contributor
John-Paul,

I found when implementeing a similar solution the above method did not work as the gp service is not expecting to receive any input parameters for your offset A etc...

So what I did was in the model used the calculate field tool to populate each field value, these can then be set as a model parameter so that the service is expecting to receive the values ( just make sure that you set the Expression type to python otherwise the model will not calculate the fields when published on the server see http://resources.esri.com/help/9.3/arcgisdesktop/com/gp_toolref/data_management_tools/calculate_fiel...)

Hope this helps if you are still having issues

Regards

Anthony
0 Kudos
Jon-PaulMcCool1
Emerging Contributor
I am still having problems with this. I have set up the model below, and put it on the server. The expressions are in python and are set as parameters for the model. The geoprocessing service lists them as required parameters: http://egis.artsci.uc.edu/ArcGIS/rest/services/PRAGIS/GPServer/VSProcess

I have customized the xml file for the geoprocessing tool as given below, and the tool interface is seen in the third image. I have tried parameter types string, double, and long for the numerical inputs yet none work. The tool in arcmap work appropriately with the offsets and radius values, yet when using the service through the tool it seems to ignore them. It is even ignoring the default values for the parameters (the default for Radius2exp is 10000 meters and the results it is outputting is far beyond that). Any ideas someone has please let me know. I am at my wits end trying to get this tool to work appropriately.

<?xml version="1.0" ?>
<configuration>
    <description/>
    <taskurl>http://egis.artsci.uc.edu/ArcGIS/rest/services/PRAGIS/GPServer/VSProcess</taskurl>
    <helpurl>http://egis:8399/arcgis/server/arcgisoutput/PRAGISfull/Model.htm</helpurl>
    <autosubmit>false</autosubmit>
    <inputparams>
        <param type="featurerecordset"     name="Input_point_or_polyline_observer_features"
geometrytype="point"
required="true"
visible="true"
label="Input Observation Point(s)"
tooltip="Select desired observation point(s)">
            <renderer type="simple">
                <defaultsymbol type="simplemarker" alpha="1" color="0x3FAFDC" size="15">
                    <outline color="0x000000" width="2"/>
                </defaultsymbol>
            </renderer>
        </param>
<param name="OffsetAexp"
  label="Observer height (meters)"
  defaultvalue="1.6"
  required="true"
  type="double"
  visible="true"
tooltip="Height above ground surface for the observation. (EX. Human height= 1.6, Human on a 20m Pyramid= 21.6)">
</param>
<param name="OffsetBexp"
  label="Height above ground surface for observed (meters)"
  defaultvalue="0"
  required="true"
  type="double"
  visible="true"
tooltip="Height of surface being observed (EX. If wanting to see if a 10m high structure would be visible input 10.)">
</param>
<param name="Radius2exp"
  label="Maximum outer distance (meters)"
  defaultvalue="10000"
  required="true"
  type="double"
  visible="true"
tooltip="Maximum distance to be considered (EX. Visibility on a clear day is 25 mile or 40234 meters.)">
</param>
        <param type="string" name="Input_DEM" required="true" visible="true" label="Input DEM" defaultvalue="Soils and Elevation\INEGI 1:50000 DEM" tooltip="Select the DEM you would like to use.">
            <choicelist>
                <choice value="Soils and Elevation\INEGI 1:50000 DEM"/>
                <choice value="Soils and Elevation\ASTER DEM Version 2"/>
            </choicelist>
        </param>
    </inputparams>
<outputparams>
        <param name="Multipart_Viewshed"
               geometrytype="polygon"
               label="Viewshed Result"
               required="true"
               type="featurerecordset"
               visible="true">
            <renderer type="uniquevalue" attribute="GRIDCODE">
   <defaultsymbol alpha="0.5"
                               color="0xFF00FF"
                               type="simplefill">
                    <outline width="1" color="0x000000"/>
                </defaultsymbol>
   <infos>
    <symbol color="transparent"        type="simplefill" alpha="0" value="0">
   <outline alpha="0" color="transparent"/>
    </symbol>
   </infos>
            </renderer>
        </param>
    </outputparams>
    <layerorder>Input_Observation_Point_s_,Total_Viewshed_Polygon</layerorder>
</configuration>


[ATTACH=CONFIG]13639[/ATTACH]

[ATTACH=CONFIG]13640[/ATTACH]

[ATTACH=CONFIG]13641[/ATTACH]
0 Kudos
AnthonyGiles
Honored Contributor
John-Paul,

Getting geoprocessing services to work can take a lot of troubleshooting before you get a working solution. The best approach to take is to create your model and test it in ArcMap, once you have a working solution publish this to your server and again test in ArcMap. Once you are happy that you are getting your required result then integrate with flex.

If you experience problems at the second stage when testing your service in ArcMap you need to do some detailed analysis, a good place to start is turn on verbose logging in server manager and then check for any errors. A common one is the number of features being returned (I'm using 9.3.1 which has default value of 500, if this number is exceeded you just do not get a return).

If you are happy that your service is working correctly move onto integrating it with the flex viewer, a good way of checking that the correct values are being passed to the server is to use Firefox with firebug so you can see the request being made. Again use server manager log files to make sure there is no errors being generated.

If you are still having problems with the radius of your output viewshed you have two potential options. Create a buffer from your input point using your require distance and clip either your dem to that buffer (this will speed up your process) or clip your viewshed output to the buffer.

As a side note it looks like your service has been published as synchronous (submit job in rest endpoint) as opposed to asynchronous (execute task in rest endpoint). Setting the process to asynchronous will allow the end user to carry on working while the result is being processed.

Hope this helps

Anthony
0 Kudos
Jon-PaulMcCool1
Emerging Contributor
Anthony,

I did eventually get it working. There were issues with where files were being output that only became a problem when operated from the server. Thank you for your comments and help.

JP
0 Kudos
AnthonyGiles
Honored Contributor
John-Paul,

I'm glad you managed to get your viewshed working in the end. Don't forget to mark the post as answered.

Regards

Anthony
0 Kudos