I'm trying to run a script that will generate a contour map from a raster in a geodatabase, run Simplify Line on the contour map, and then run Smooth Line. At first I ran it in disk, and it worked (albeit slowly), and now I'd like to do it using the in_memory workspace. However, it returns the error message at the bottom. I've tried this in PyScripter and ArcMap with both foreground and background (64-bit) geoprocessing, and the result is the same. What is the problem with my code that is causing this to fail when I use the in_memory workspace?
>>> # -*- coding: utf-8 -*- ...
# -------------------------------------------------------------------------- - ...
# Snippet.py ...
# Created on: 2018年07月17日 11:14:47.00000 ...
# (generated by ArcGIS/ModelBuilder) ...
# Description: ...
# -------------------------------------------------------------------------- - ... ...
# Import arcpy module ...
import arcpy ...
from arcpy.sa import * ...
from arcpy.ddd import * ...
arcpy.CheckOutExtension("Spatial") ...
arcpy.CheckOutExtension("3D") ... ...
# Local variables: ...
FilteredDEM = "D:\\ArcGIS\\Folder\\Geodatabase.gdb\\FilteredDEM" ...
FiveMeterContour = "in_memory\\FiveMeterContour" ...
FiveMeterSimplify_Pnt = FiveMeterContour ...
FiveMeterSimplify = "in_memory\\FiveMeterSimplify" ...
FiveMeterSmooth = "in_memory\\FiveMeterSmooth" ... ...
# Process: Contour ...
arcpy.Contour_3d(FilteredDEM, FiveMeterContour, "5", "0", "1") ... ...
# Process: Simplify Line ...
arcpy.SimplifyLine_cartography(FiveMeterContour, FiveMeterSimplify, "BEND_SIMPLIFY", "5 Meters", "RESOLVE_ERRORS", "KEEP_COLLAPSED_POINTS", "CHECK") ... ...
# Process: Smooth Line ...
arcpy.SmoothLine_cartography(FiveMeterSimplify, FiveMeterSmooth, "BEZIER_INTERPOLATION", "0 Meters", "FIXED_CLOSED_ENDPOINT", "FLAG_ERRORS") ... ...
arcpy.CheckInExtension("Spatial") ...
arcpy.CheckInExtension("3D") ...
Result:
Runtime error Traceback (most recent call last):
File "", line 27, in File "c:\program files (x86)\arcgis\desktop10.4\arcpy\arcpy\cartography.py", line 1340, in SimplifyLine
raise e ExecuteError: ERROR 000207:
Cannot create intermediate output GPInMemoryWorkspace:{5568791D-08F7-4A36-BC5F-A640D3D64572}\FiveMeterSimplify_TmpIn Failed to execute (SimplifyLine). >>>
1 Answer 1
I have not tested this but I notice that the syntax for Simplify Line is:
SimplifyLine_cartography (in_features, out_feature_class, algorithm, tolerance, {error_resolving_option}, {collapsed_point_option}, {error_checking_option})
The help also says that:
in_features
must be of data type Feature Layerout_feature_class
will be of data type Feature Class
I have a suspicion that it may be you providing a feature class in an in-memory workspace as your in_features
instead of a feature layer that is tripping it up. Perhaps you can use Make Feature Layer on that feature class in an in-memory workspace first.
However, the workaround that @KHibma suggests, of using Generalize instead, may be the simplest option. Although I note that uses a Feature Layer as input too.
-
Thanks! Here's my results: 1) It worked when I converted the output feature classes into feature layers. 2) Simplify Line worked when I used a smaller DEM; Generalize works with larger datasets (must be a memory issue). 3) Simplify line can't do topo checks in memory; it works when no check is done. I also tried using Repair Geometry, out of curiosity, and it didn't work either.Matthew– Matthew2018年07月23日 14:47:30 +00:00Commented Jul 23, 2018 at 14:47
Explore related questions
See similar questions with these tags.
NO_KEEP
andNO_CHECK