1

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). >>>
4
  • I wonder if the last 2 parameters and the topo checks have anything to do with it? Try changing the last 2 to NO_KEEP and NO_CHECK
    – KHibma
    Commented Jul 18, 2018 at 16:46
  • I changed the parameters accordingly, and I no longer get that error message. Instead, when I use background processing, it throws Error 001143. In foreground processing, it crashes.
    – Matthew
    Commented Jul 18, 2018 at 19:04
  • How about trying the Generalize tool instead? Does basically the same thing as SimplifyLine.
    – KHibma
    Commented Jul 18, 2018 at 19:37
  • That worked, thanks. So it seems like it works when it's operating on the same feature class, but doesn't work when the input and output are different feature classes.
    – Matthew
    Commented Jul 19, 2018 at 13:02

1 Answer 1

0

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 Layer
  • out_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.

1
  • 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
    Commented Jul 23, 2018 at 14:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.