POST
|
Is it possible to use a geoprocessing map server result in a widget in Web App Builder? I have a geoprocessing service that is set to return a map service, I want to be able to use the chart widget to graph the resulting data. However, whenever I add the GP services's map server URL the chart widget only plots the data the tool output when it was published, or it returns an error. I'm at a loss as to what is going wrong, any help is appreciated.
... View more
03-07-2019
03:36 PM
|
0
|
1
|
325
|
POST
|
I have Python toolbox that I have published a geoprocessing service. It works great in arcmap, and it works great after publishing when I access it from arcmap. However when I try to use it in web app builder it fails, the error reads: Traceback (most recent call last): File "", line 113, in execute File "c:\program files\arcgis\server\arcpy\arcpy\management.py", line 17147, in GetCellValue raise e ExecuteError: ERROR 000622: Failed to execute (Get Cell Value). Parameters are not valid. ERROR 000628: Cannot set input into parameter location_point. . I have no clue why this is failing earlier versions of this script published as gp services have worked perfectly in the past. If anyone here can figure this out I would be grateful. # Top Comments
# Start script
#-----------------------------------------------------------------------------
import arcpy
import os
# Tool initialization
#-----------------------------------------------------------------------------
class Toolbox(object):
def __init__(self):
"""Define the toolbox (the name of the toolbox is the name of the
.pyt file)."""
self.label = "Value_Extraction_Tool"
self.alias = "Value Extraction Tool"
# List of tool classes associated with this toolbox
self.tools = [Tool]
class Tool(object):
def __init__(self):
"""Define the tool (tool name is the name of the class)."""
self.label = "Value Extraction Tool"
self.description = ""
self.canRunInBackground = False
def getParameterInfo(self):
DataSource = arcpy.Parameter(
displayName="DataSource",
name="DataSource",
datatype="DEWorkspace",
parameterType="Required",
direction="Input")
InputPoint = arcpy.Parameter(
displayName="InputPoint",
name="InputPoint",
datatype="DEFeatureClass",
parameterType="Required",
direction="Input")
OutputFC = arcpy.Parameter(
displayName="OutputFC",
name="OutputFC",
datatype="DEFeatureClass",
parameterType="Required",
direction="Output")
params = [DataSource, InputPoint, OutputFC]
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):
# User input arguments
DataSource = parameters[0].valueAsText
InputPoint = parameters[1].valueAsText
OutputFC = parameters[2].valueAsText
# Handle all input point procesing
arcpy.CopyFeatures_management(InputPoint, OutputFC)
arcpy.AddXY_management(InputPoint)
# Add fields to hold temporal data
arcpy.AddField_management(OutputFC, "LABEL", "TEXT")
arcpy.AddField_management(OutputFC, "VALUE", "DOUBLE")
# Loop through geometry attributes and get the x and y
with arcpy.da.SearchCursor(InputPoint,"*") as cursor:
PointIndex = 1
for row in cursor:
X = row[3]
Y = row[4]
arcpy.AddMessage(str(X) + " " + str(Y))
# Get rasters and extract data at an X and Y
index = 0
for (path, dirs, files) in os.walk(DataSource):
for ThisFile in files:
fName,fExt = os.path.splitext(ThisFile)
if fExt.upper() == ".IMG" or fExt.upper() == ".TIF":
RasterPath = path + "\\" + ThisFile
data = (arcpy.GetCellValue_management(RasterPath, str(X) + " " + str(Y), ""))
aquisition_date = arcpy.GetRasterProperties_management(in_raster = RasterPath, property_type = "ACQUISITIONDATE")
if str(aquisition_date).upper() == "UNKNOWN":
insertcursor = arcpy.InsertCursor(OutputFC)
row = insertcursor.newRow()
row.setValue("POINTID", PointIndex)
row.setValue("LABEL", "{}, Point: {}".format(index, PointIndex))
row.setValue("VALUE", data)
insertcursor.insertRow(row)
del insertcursor
index += 1
PointIndex += 1
return
... View more
02-27-2019
11:22 AM
|
0
|
2
|
754
|
POST
|
Thanks, guess I must have misread something when I said it doesn't support tables, says right in there it does. I still don't know what I'm doing wrong, I ran this script successfully with a table output in arcmap only to have it fail in server. It kept creating the table locally on my machine and the feature class on the server. I've overcome this problem by returning a large feature class with 1 point per raster that holds the associated data. I know it's not the greatest way to do this, but its working.
... View more
02-25-2019
11:45 AM
|
0
|
1
|
1012
|
POST
|
I was trying a few different table outputs, I accidentally pasted in a version of the script with a different table type. Whenever I've written one of these python toolboxes I've never had to use create feature class,when outputting a feature class, a blank one would be automatically be created. Ultimately this is all a mute point since I'm trying to use this script as a custom geoprocessing service and I just read that GP services on arcserver don't support tables.
... View more
02-24-2019
06:40 PM
|
1
|
3
|
1012
|
POST
|
Hi Morgan, I have this running as a GP service on Arc Server, I get this error when the service executes on the server. I read that Arc Server GP tools only return primitive data types, they won't return tables and relationship classes, I think thats the root cause of this error.
... View more
02-21-2019
04:26 PM
|
0
|
0
|
452
|
POST
|
I stumbled upon this thread and am trying to do the same thing, has anyone here figured this out?
... View more
02-18-2019
03:07 PM
|
0
|
0
|
405
|
POST
|
Sort of, it seems like Arc wont create a table inherently like it will a feature class, guess I'll have to break up that input string to create a table. I've posted the entire updated script above.
... View more
02-18-2019
10:54 AM
|
0
|
0
|
1012
|
POST
|
Hi Everyone, I'm working on a project where I use a custom python toolbox tool as a geoprocessing service in web app builder. The goal is a GP service that accepts a point feature class, drawn by the person using the web app, then extracts values at that point and builds a table of that data to be related to an output feature class which is charted by the related table chart widget. This is all so someone can compare temporal data at multiple locations. I have the tool written and it works fine in arcmap, but for the life of me I cannot figure out how to get it to work as a GP service. I published it, but I keep getting the error 000464 Cannot get exclusive schema lock. Either being edited or in use by another application. Any help on this would be greatly appreciated. # Start script
#-----------------------------------------------------------------------------
import arcpy
import os
# Tool initialization
#-----------------------------------------------------------------------------
class Toolbox(object):
def __init__(self):
"""Define the toolbox (the name of the toolbox is the name of the
.pyt file)."""
self.label = "Value_Extraction_Tool"
self.alias = "Value Extraction Tool"
# List of tool classes associated with this toolbox
self.tools = [Tool]
class Tool(object):
def __init__(self):
"""Define the tool (tool name is the name of the class)."""
self.label = "Value Extraction Tool"
self.description = ""
self.canRunInBackground = False
def getParameterInfo(self):
DataSource = arcpy.Parameter(
displayName="DataSource",
name="DataSource",
datatype="DEWorkspace",
parameterType="Required",
direction="Input")
InputPoint = arcpy.Parameter(
displayName="InputPoint",
name="InputPoint",
datatype="DEFeatureClass",
parameterType="Required",
direction="Input")
Output = arcpy.Parameter(
displayName="OutputFC",
name="OutputFC",
datatype="DEFeatureClass",
parameterType="Required",
direction="Output")
params = [DataSource, InputPoint, Output]
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):
# User input arguments
DataSource = parameters[0].valueAsText
InputPoint = parameters[1].valueAsText
Output = parameters[2].valueAsText
# Variables
Workspace = r"E:\Time_Series_Graphing_project\Development.gdb"
DataTable = r"E:\Time_Series_Graphing_project\Development.gdb\TemporalData"
DataRelationship = r"E:\Time_Series_Graphing_project\Development.gdb\DataRelationship"
# Delete old verions
if arcpy.Exists(DataTable):
arcpy.Delete_management(DataTable)
arcpy.AddMessage("Old table deleted")
if arcpy.Exists(DataRelationship):
arcpy.Delete_management(DataRelationship)
if arcpy.Exists(InputPoint):
arcpy.Delete_management(InputPoint)
if arcpy.Exists(Output):
arcpy.Delete_management(Output)
# Handle all input point procesing
arcpy.AddGeometryAttributes_management(InputPoint, "POINT_X_Y_Z_M", "", "", 4326)
arcpy.CopyFeatures_management(InputPoint , Output)
# Create a table to hold the temporal data
arcpy.CreateTable_management(Workspace, "TemporalData")
arcpy.AddField_management(DataTable, "POINTID", "SHORT")
arcpy.AddField_management(DataTable, "DATAINDEX", "SHORT")
arcpy.AddField_management(DataTable, "VALUE", "DOUBLE")
# Loop through geometry attributes and get the x and y
with arcpy.da.SearchCursor(InputPoint,"*") as cursor:
PointIndex = 1
for row in cursor:
X = row[3]
Y = row[4]
arcpy.AddMessage(str(X) + " " + str(Y))
# Get rasters and extract data at an X and Y
index = 0
for (path, dirs, files) in os.walk(DataSource):
for ThisFile in files:
fName,fExt = os.path.splitext(ThisFile)
if fExt.upper() == ".IMG" or fExt.upper() == ".TIF":
RasterPath = path + "\\" + ThisFile
data = (arcpy.GetCellValue_management(RasterPath, str(X) + " " + str(Y), ""))
aquisition_date = arcpy.GetRasterProperties_management(in_raster = RasterPath, property_type = "ACQUISITIONDATE")
if str(aquisition_date).upper() == "UNKNOWN":
insertcursor = arcpy.InsertCursor(DataTable)
row = insertcursor.newRow()
row.setValue("POINTID", PointIndex)
row.setValue("DATAINDEX", index)
row.setValue("VALUE", data)
insertcursor.insertRow(row)
del insertcursor
index += 1
PointIndex += 0
del row
del cursor
# Create Relationship
arcpy.CreateRelationshipClass_management(Output, DataTable, DataRelationship, "COMPOSITE", "","", "NONE", "ONE_TO_MANY", "NONE","POINTID","POINTID")
return
... View more
02-16-2019
10:12 AM
|
0
|
2
|
670
|
POST
|
Hi Everyone, I am working on a toolbox that creates a table of extracted values. I have the output parameter set to DEtable, but whenever I run the tool the table is not created. Any help on this would be appreciated. # Start script
#-----------------------------------------------------------------------------
import arcpy
import os
# Tool initialization
#-----------------------------------------------------------------------------
class Toolbox(object):
def __init__(self):
"""Define the toolbox (the name of the toolbox is the name of the
.pyt file)."""
self.label = "Value_Extraction_Tool"
self.alias = "Value Extraction Tool"
# List of tool classes associated with this toolbox
self.tools = [Tool]
class Tool(object):
def __init__(self):
"""Define the tool (tool name is the name of the class)."""
self.label = "Value Extraction Tool"
self.description = ""
self.canRunInBackground = False
def getParameterInfo(self):
DataSource = arcpy.Parameter(
displayName="DataSource",
name="DataSource",
datatype="DEWorkspace",
parameterType="Required",
direction="Input")
InputPoint = arcpy.Parameter(
displayName="InputPoint",
name="InputPoint",
datatype="DEFeatureClass",
parameterType="Required",
direction="Input")
OutputTB = arcpy.Parameter(
displayName="OutputTB",
name="OutputTB",
datatype="DEArcInfoTable",
parameterType="Required",
direction="Output")
params = [DataSource, InputPoint, OutputTB]
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):
# User input arguments
DataSource = parameters[0].valueAsText
InputPoint = parameters[1].valueAsText
OutputTB = parameters[2].valueAsText
# Add geometry attributes to inupt point
arcpy.AddGeometryAttributes_management(InputPoint, "POINT_X_Y_Z_M", "", "", 4326)
# add fields to output table to hold the temporal data
arcpy.AddField_management(OutputTB, "POINTID", "SHORT")
arcpy.AddField_management(OutputTB, "DATAINDEX", "SHORT")
arcpy.AddField_management(OutputTB, "VALUE", "DOUBLE")
# Loop through geometry attributes and get the x and y
with arcpy.da.SearchCursor(InputPoint,"*") as cursor:
PointIndex = 0
for row in cursor:
X = row[3]
Y = row[4]
# Get rasters and extract data at an X and Y
index = 0
for (path, dirs, files) in os.walk(DataSource):
for ThisFile in files:
fName,fExt = os.path.splitext(ThisFile)
if fExt.upper() == ".IMG" or fExt.upper() == ".TIF":
RasterPath = path + "\\" + ThisFile
data = (arcpy.GetCellValue_management(RasterPath, str(X) + " " + str(Y), ""))
aquisition_date = arcpy.GetRasterProperties_management(in_raster = RasterPath, property_type = "ACQUISITIONDATE")
if str(aquisition_date).upper() == "UNKNOWN":
insertcursor = arcpy.InsertCursor(OutputTB)
row = insertcursor.newRow()
row.setValue("POINTID", PointIndex)
row.setValue("DATAINDEX", index)
row.setValue("VALUE", data)
insertcursor.insertRow(row)
del insertcursor
index += 1
PointIndex += 0
del row
del cursor
return
... View more
02-16-2019
09:15 AM
|
0
|
8
|
1322
|
POST
|
I got it to work with the older arcpy.InsertCursor, thanks for your help.
... View more
02-14-2019
09:24 AM
|
0
|
0
|
587
|
POST
|
Hi all, I'm having some trouble with an insert cursor, I keep getting the error, Traceback (most recent call last): File "<string>", line 129, in execute SystemError: error return without exception set Failed to execute (Tool) Can anyone help me with this error? with arcpy.da.Editor(r"E:\Time_Series_Graphing_project") as edit: with arcpy.da.InsertCursor(r"E:\Time_Series_Graphing_project\TemporalData", ("POINTID", "DataIndex", "Value"))as cursor: cursor.insertRow((PointIndex, index, data))
... View more
02-11-2019
11:53 AM
|
0
|
4
|
734
|
POST
|
Hi everyone, I have a python toolbox tool I want to use as a geoprocessing service, its a pretty simple script, it goes through a folder of rasters and extracts values at each one according to x and ys provided by the client. I want the extracted values returned to the client, but I'm a little lost on what needs to be done on the script side to achieve that. Is arcGIS Server smart enough to take any output and convert it into a javascript object to be returned to the client? Do I need a specific output type for the server to convert it into a javascript object?
... View more
01-15-2019
05:52 AM
|
0
|
1
|
504
|
POST
|
That's what I thought, this service as it stands returns a text file, I want the values in the text file for graphing in the web browser. I'm pretty sure I need to change the script and republish the service with a result data type that is more suitable, but is there a way to achieve that with the existing service?
... View more
12-27-2018
12:58 PM
|
0
|
0
|
392
|
Title | Kudos | Posted |
---|---|---|
1 | 03-13-2019 12:28 PM | |
1 | 05-01-2018 04:29 PM | |
1 | 06-07-2017 12:21 PM | |
1 | 02-24-2019 06:40 PM | |
3 | 11-11-2019 08:47 AM |
Online Status |
Offline
|
Date Last Visited |
02-24-2022
08:12 AM
|