POST
|
You've got a couple questions here. To answer the "getting the file back" - your GP Service (most likely a python script) would create a .XLS file. The tool (gp task) would return a file. In your say, JavaScript based web app, you'd invoke the service and the GP Service would return the file. Check out the clip and ship sample. This demonstrates executing a task that returns a file. The part of your question I'm unsure of is whats happening on the web client (which sounds like it sends data?) to the GP Service which in turn gets turned into excel? Theres multiple ways to interact with GP via the web in regards to input parameters. I dont want to suggest 1 way as ultimately it depends on how you have data and how the service will accept it. For this part of your task your web development and task (python script) development will have to work together. You'll probably need to build an app that is capable of sending data in an expected way to the gp task. OR you have to build your python script to accept data and possible massage it so you can then convert it. Hope these ideas move you forward some. Thanks for the quick response. I'm sorry if I was unclear, but I am not sending data to the GP Service, just initiaiting it from a button or some control on the client browser. Something like "Create Quarter Section Report" What I want to do is execute a script tool on the server that calls a toolbox tool that does some spatial queries, say by Make Query Layer, or Make Query Table, or ArcSDEExecute and use the results of those tools to format into a report and return the Excel file back to the browser when complete. Ideally it would be an async initiate/ response, so the GUI isn't blocked and waiting for the GP Service to finish. And I'd like the Excel creation to all be Python if possible, so I don't have to fake an output stream in .NET by setting mime-types in a response header. I did not realize you could set an output argument of type file for a ArcGIS Server Published GP Service. I will look at the example you provided and proceed from there. Thanks again, Brad
... View more
03-06-2013
09:26 AM
|
0
|
0
|
353
|
POST
|
I need a strategy to create an and return an Excel spreadsheet as the result of a web-initiated GeoProcessing tool. It feels like a common problem that has probably been solved already. Would one process the result on the web-client (javascript) to create rows in a spreadsheet or CSV, or put the result, say a table in an in_memory workspace, then write python to create an Excel file from the geoprocessing result on the server. If I used the python way, how do I stream it back to the client? Use native python web-api? Or would I have the javascript client initiate the GP task, and when notified of completion, send another AJAX request to fetch the Excel result from a web-service, say ASP.Net or Django? Need some patterns to play with! Thanks, Brad
... View more
03-06-2013
05:22 AM
|
0
|
3
|
2077
|
POST
|
GPers, Having given up on ModelBuilder and Script Tools due to repeated Arc Desktop crashes, I have arrived down at the bare-metal: the promising Python Toolbox. I'm trying to write a tool that allows the user choose the workspace, then select from a specific set of feature classes, then automatically fill a dropdown of filtered subtypes for the selected feature. This immediately presents the following problems: What datatype to set for the parameters? Should I make them all string instead of Workspace, feature class, etc Is there an enumeration for the arcpy parameter datatypes so I don't have to type the bloody things and spell them correctly? How to detect the appropriate change-events? Should I set parameterDependencies() for any of them? What is the actual datatype of arcpy.Parameter.value? a describe object? a string? type (arcpy.Parameter.value) merely returns "property" Is there an arcpy.mapping dialog box that can display a table control? For coded picklists, like subtypes, what is the strategy for picking the value, yet returning the code so it can be used in a SQL expression? The best I've seen is a list expansion with a value matching criteria. Can this be handled if the argument were defined as a Field Info instead? Thus far, this is all I've been able to muster with no success:
import arcpy
class Toolbox(object):
def __init__(self):
"""Define the toolbox (the name of the toolbox is the name of the
.pyt file)."""
self.label = "Toolbox"
self.alias = ""
# List of tool classes associated with this toolbox
self.tools = [FeaturesBySubtype]
class AbstractTool(object):
def __init__(self):
"""Define the tool (tool name is the name of the class)."""
self.label = "Tool"
self.description = ""
self.canRunInBackground = False
def getParameterInfo(self):
"""Define parameter definitions"""
params = None
return params
def isLicensed(self):
"""Set whether tool is licensed to execute."""
return True
def updateParameters(self, parameters):
"""Modify the values and properties of parameters before internal
validation is performed. This method is called whenever a parameter
has been changed."""
return
def updateMessages(self, parameters):
"""Modify the messages created by internal validation for each tool
parameter. This method is called after internal validation."""
return
def execute(self, parameters, messages):
"""The source code of the tool."""
return
class FeaturesBySubtype(AbstractTool):
def __init__(self):
self.label = "Query Features By Subtype"
self.description = "Return all the features of the specified subtype for the specified feature class"
self.canRunInBackground = True
def getParameterInfo(self):
p1 = arcpy.Parameter(
displayName="Workspace",
name="in_workspace",
datatype="Workspace",
parameterType="Required",
direction="Input")
p2 = arcpy.Parameter(
displayName="Feature Class",
name="in_featureclass",
datatype="Feature Class",
parameterType="Required",
direction="Input")
p3 = arcpy.Parameter(
displayName="Subtype",
name="in_subtype",
datatype="string",
parameterType="Required",
direction="Input")
p4 = arcpy.Parameter(
displayName="Output Table",
name="out_resulttable",
datatype="Table View",
parameterType="Required",
direction="Output")
params = [p1,p2,p3,p4]
return params
def updateParameters(self, parameters):
if parameters[0].value:
arcpy.env.workspace=parameters[0].value
for a_parm in parameters:
if a_parm.altered and not(a_parm.hasBeenValidated):
a_parm.setWarningMessage(str.format('Parameter modified {0}', a_parm.name) )
parameters[1].filter.list=['Fuse','Switch']
st = arcpy.da.ListSubtypes('Fuse')
parameters[2].filter.type='ValueList'
parameters[2].filter.list = st.values()
return
def execute(self, parameters, messages):
arcpy.AddMessage(parameters)
tableList = [parameters[1].value]
fc_descr = arcpy.Describe ( parameters[1].value)
subtype_field = fc_descr.subtypeFieldName
whereClause = str.format("{0}={1}",subtype_field,parameters[2].value)
lyrName = "QueryOutput"
arcpy.AddMessage(whereClause)
# Make Query Table...
arcpy.MakeQueryTable_management(tableList, lyrName, None, None, None, whereClause)
# Print the total rows
arcpy.AddMessage( arcpy.GetCount_management(lyrName))
return
... View more
02-28-2013
05:07 AM
|
0
|
1
|
569
|
POST
|
I created a 5 line python script tool:
import arcpy
import sys
input_value = arcpy.GetParameterAsText(0)
output_message = "Hello World " + input_value
arcpy.SetParameterAsText(1, output_message )
I ran it and got a result. I right-clicked/shared the result and said "publish as a service", selected the server, filled in the required description fields I pushed publish and receive: "ERROR: unable to connect to publishing tool. Verify the service is up and running" I checked, and the service is indeed up and running and there are no log files on the server to indicate that any attempt was made to do anything. Any help is greatly appreciated! Brad
... View more
02-04-2013
09:32 AM
|
0
|
1
|
359
|
POST
|
If you have ArcGIS Desktop on the same machine as ArcGIS Server (AGS), then you will also need the 32 bit Oracle Client since ArcGIS Desktop is still 32 bit software. There is ESRI documentation on this scenario in the setup for AGS. I believe it will not copy the SDE data to the server once the 32 bit client is installed as I ran across this same scenario myself. Originally, the 32-bit Oracle client was installed along with Desktop and Server. In this case, you cannot register an Oracle SDE datastore with Server, because Server requires the 64-bit client. Once we got the 64-bit client installed, we were able to register the database with Server. Now we are trying to publish something, with no success.
... View more
02-01-2013
12:59 PM
|
0
|
0
|
611
|
POST
|
This is the view-source for the page:
<html>
<head>
<title>Data</title>
</head>
<body>
<html>
<head>
<link href="https://community.esri.com/arcgis/admin/www/css/admin.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="/arcgis/admin/www/js/BigInt.js" charset="utf-8"></script>
<script type="text/javascript" src="/arcgis/admin/www/js/Barrett.js" charset="utf-8"></script>
<script type="text/javascript" src="/arcgis/admin/www/js/RSA.js" charset="utf-8"></script>
<script type="text/javascript" src="/arcgis/admin/www/js/admin.js" charset="utf-8"></script>
</head>
<table width="100%" id="userInfoTable">
<tbody>
<tr>
<td id="titleCell">ArcGIS Server Administrator Directory</td>
<td align="right" id="help">
Logged in:
|
<a href="https://community.esri.com/arcgis/admin/login?operation=signout">Signout</a>
</td>
</tr>
</tbody>
</table>
<table width="100%" id="navTable">
<tbody>
<tr>
<td id="breadcrumbs">
<a href="https://community.esri.com/arcgis/admin">Home</a>
>
<a href="https://community.esri.com/arcgis/admin/data">data</a>
>
<a href="https://community.esri.com/arcgis/admin/data/config">config</a>
>
<a href="https://community.esri.com/arcgis/admin/data/config/update">update</a>
</td>
<td align="right" id="help">
<a href="https://community.esri.com/arcgis/admin/www/api/admin-rest-api.html">Quick Reference</a>
|
<a href="https://community.esri.com/arcgis/admin/www/doc/index.html" target="blank">API Reference</a>
</td>
</tr>
</tbody>
</table>
<h2>Data Space</h2>
<div class="body">
<table>
<tbody>
<tr>
<td><b>Resources:</b></td>
<td><a href="https://community.esri.com/arcgis/admin/data/items">Root Items</a></td>
</tr>
<tr>
<td><b>Supported Operations:</b></td>
<td><a href="https://community.esri.com/arcgis/admin/data/registerItem">Register Item</a></td>
<td><a href="https://community.esri.com/arcgis/admin/data/unregisterItem">Unregister Item</a></td>
<td><a href="https://community.esri.com/arcgis/admin/data/validateDataItem">Validate Item</a></td>
<td><a href="https://community.esri.com/arcgis/admin/data/validateAllDataItems">Validate All Items</a></td>
<td><a href="https://community.esri.com/arcgis/admin/data/findItems">Find Items</a></td>
<td><a href="https://community.esri.com/arcgis/admin/data/computeTotalRefCount">Compute Total Ref Count</a></td>
</tr>
</tbody>
</table>
</div>
</body>
</html>
... View more
02-01-2013
08:20 AM
|
0
|
0
|
946
|
POST
|
And if you copy and paste the link I provided, does it take you anywhere? Can you try to clear your browser history or use a different browser? The above image was the result of using your URL. The exception is that I'm remote from the server. I will obtain rights to login directly to our server and try the "localhost" instead of a using proper domain and see if that makes any difference. Can you capture a screenshot of what the actual dialog is?
... View more
02-01-2013
08:05 AM
|
0
|
0
|
946
|
POST
|
So is there a warning that the data will be copied to the server or no? Yes. And there is no option to not upload.
... View more
02-01-2013
08:01 AM
|
0
|
0
|
611
|
POST
|
Sorry I was not clear: I have registered he SDE geodatabase as a datastore with ArcGIS server using the 64 bit client.
... View more
02-01-2013
05:29 AM
|
0
|
0
|
611
|
POST
|
If found this in the help file: To disable data from being copied to the server, follow the instuctions below. Steps: 1. Open the Administrator Directory and log in with a user that has administrative permissions to your site. The Administrator Directory is typically available at http://<server name>:6080/arcgis/admin. 2.Click data > config > update. 3.On the Update Datastore Configuration page, enter the following string into the Datastore Configuration Properties dialog box: {"blockDataCopy": true} 4.Click Update. HOWEVER-- There is no config/update path under arcgis/admin/data--or anywhere in the admin pages that I can find. SO there is no "update" option, and no Datastore Configuration Properties dialog box to be found. Hence nowhere to put {"blockDataCopy":true} What file does this get stored in on the server and can I just notepad it in order to get past this trainwreck of a week? Brad
... View more
01-31-2013
12:01 PM
|
0
|
9
|
1197
|
POST
|
I have registered an SDE geodatabase with ArcGIS Server. I have an MXD that refers to the same geodatabase and so proceed to "share as" in ArcMap I fixed the "Analyze"-detected problems so all that are left are warnings. I click publish, spins its gears, until it asks me what data to upload. WTF, I don't want to upload any data, just publish my flippin' MXD after 3 days of horsing around... Where in any dialog do you EXPLICITLY connect your MXD to a published datastore? And if you can't do that, how does it ACTUALLY do it behind the scenes then? Is it comparing Oracle alias name? .sde connection file names? Beyond frustrating. Brad
... View more
01-31-2013
10:43 AM
|
0
|
8
|
1806
|
POST
|
Finally found the answer. The "onComplete" callback function was adding the queried features to an HTML select dropdown list. The add(newoption,beforeoption) method is not browser agnostic. IE handled the case where I threw it .add(option) and omitted the second argument to add at the end of the list. Firefox threw an exception and fired the "onError" function of the queryTask. Firefox wants a null argument. The final code is: var addarg = dojo.isIE ? 0 : null; dropdown.add(opt, addarg);
... View more
03-11-2011
09:53 AM
|
0
|
0
|
212
|
POST
|
myns.queryFacilities = function () { var myQueryTask = new esri.tasks.QueryTask(myns.basemapURL + "/" + myns.facilityLayerID.toString() ); var myQuery = new esri.tasks.Query(); myQuery.where = "AMS_FacID is not null"; myQuery.outFields = ['AMS_FacID', 'FAC_NAME']; //, 'LLat', 'LLong']; myQuery.returnGeometry = true; dojo.connect (myQueryTask, "onComplete", myns.facilityQuerySuccess); dojo.connect (myQueryTask, "onError", myns.facilityQueryError); myQueryTask.execute(myQuery); };
... View more
03-11-2011
08:34 AM
|
0
|
0
|
212
|
POST
|
The following line looks like it may be missing a /: var queryTask = new esri.tasks.QueryTask(servicename+lyrind); Can you do this instead? var qturl = servicename+lyrind; alert (qturl); var queryTask = new esri.tasks.QueryTask(qt); Just want to make sure you have a valid url to query. brad
... View more
03-11-2011
07:40 AM
|
0
|
0
|
465
|
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:23 AM
|