POST
|
ArcPad struggles with rasters, and they have to be formatted just so. The most reliable way that I have found to prepare/convert rasters for ArcPad is to open them in ArcMap, right click on them in the table of contents, and under 'Output Raster' make sure that the 'Use Renderer' and 'Force RGB' options are toggled.
... View more
04-13-2016
09:37 AM
|
0
|
2
|
421
|
POST
|
Finally got it to work by carefully formatting the fully qualified path names. def execute(self, parameters, messages):
"""Execute linear orientation analysis."""
input = parameters[0].valueAsText
baseName = arcpy.Describe(input).baseName
basePath = os.path.split(arcpy.Describe(input).catalogPath)[0]
arcpy.env.workspace = basePath
#overwrite doesn't work, tool still fails if output already exists
arcpy.env.overwriteOutput = True
#output names
mbg = "{0}_MBG".format(baseName)
cents = "{0}_centroids".format(baseName)
intersectOutput = "{0}_MBG_Intersect".format(baseName)
#output
arcpy.MinimumBoundingGeometry_management(input,
mbg,
"CONVEX_HULL",
"NONE", "#",
"MBG_FIELDS")
arcpy.FeatureToPoint_management(input,
cents,
"INSIDE")
#=======================================================================
arcpy.Intersect_analysis(in_features = [r'{0}\\{1}'.format(basePath, mbg),r'{0}\\{1}'.format(basePath, cents)],
out_feature_class = intersectOutput,
join_attributes = "ALL",
cluster_tolerance = "-1 Unknown",
output_type="POINT")
#=======================================================================
return Nothing I tried using single slashes worked, the intersect tool apparently needed '\\' regardless of whether or not you passed a raw string using 'r' or not. How obscure is that...
... View more
04-13-2016
09:31 AM
|
0
|
0
|
404
|
POST
|
Tried that, along with some other basic debugging trying to tackle basic issue like this. Still no joy, even with the fully qualified path names to the feature classes. I also tried enclosing the intersect call within its own function outside of def execute and passing the parameters to a seperate function; that did not work, either. Running Intersect manually on the two outputs afterwards works fine, however; no problems there.
... View more
04-11-2016
10:23 AM
|
0
|
2
|
404
|
POST
|
Creating a python toolbox using the ESRI .pyt format. This tool is very straight forward (at least in theory) in that one polygon input generates three outputs: a convex hull layer for the input polys, a centroid layer for the input polys, and an intersection of the convex hull and centroids. def execute(self, parameters, messages):
"""Execute linear orientation analysis."""
input = parameters[0].valueAsText
baseName = arcpy.Describe(input).baseName
arcpy.env.workspace = arcpy.Describe(input).catalogPath
#overwrite doesn't work, tool still fails if output already exists
arcpy.env.overwriteOutput = True
#output names
mbg = "{0}_MBG".format(baseName)
cents = "{0}_centroids".format(baseName)
intersectOutput = "{0}_MBG_Intersect".format(baseName)
#output
arcpy.MinimumBoundingGeometry_management(input,
mbg,
"CONVEX_HULL",
"NONE", "#",
"MBG_FIELDS")
arcpy.FeatureToPoint_management(input,
cents,
"INSIDE")
arcpy.Intersect_analysis(in_features = [mbg, cents],
out_feature_class = intersectOutput,
join_attributes = "ALL",
cluster_tolerance = "-1 Unknown",
output_type="INPUT")
return Stack trace on the error seems to indicate that arcpy.Intersect_Analysis cannot find the feature classes generated by MinimumBoundingGeometry and FeatureToPoint that the script just created: Traceback (most recent call last): File "<string>", line 111, in execute File "c:\program files (x86)\arcgis\desktop10.3\arcpy\arcpy\analysis.py", line 289, in Intersect raise e ExecuteError: Failed to execute. Parameters are not valid. ERROR 000732: Input Features: Dataset C:\GISData\scratch\acir_runs\Hernando_Fuzzy2.gdb\Mines\Mines_MBG #;C:\GISData\scratch\acir_runs\Hernando_Fuzzy2.gdb\Mines\Mines_centroids # does not exist or is not supported Failed to execute (Intersect). Commenting out lines 26-30 produces viable output from the MBG and F2P tools. Anybody run into this one before? Am I missing something obvious - perhaps scoping issues - inherent to .pyc toolboxes/classes, or this is another instance of arcpy $#!^ing the bed?
... View more
04-11-2016
10:05 AM
|
0
|
4
|
2374
|
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:23 AM
|