AnsweredAssumed Answered

SlectLayerByLocation using the in_memory storage

Question asked by TomGeo on Mar 14, 2012
Latest reply on Mar 15, 2012 by Hornbydd
Dear all,

I'm trying for some time now to get a selection done while using date I stored at the 'in_memory' location.

import arcpy as gp from arcpy import env  env.workspace = "C:\\Projects\\Universal.gdb" env.overwriteOutput = True  inMemoryLyr = gp.MakeFeatureLayer_management("\\Background\\CPR_new", "in_memory/CPR") inMemoryKKH = gp.FeatureClassToFeatureClass_conversion("\\Buffer\\KKH", "in_memory", "KKH") gp.AddMessage("All variables in memory")  lstOutput = []  rowsKKH = gp.SearchCursor(inMemoryKKH)  gp.AddMessage("Search Cursor created")  for row in rowsKKH:     try:         gp.SelectLayerByLocation_management(inMemoryLyr, "INTERSECT", row, "5000 Meters", "NEW_SELECTION")     except:         gp.AddWarning("Selection failed, check: select_features and search_distance")              try:         pntID = int(row.getValue("ID")) # Integer         pntX = row.getValue("X_COORDINA") # Double         pntY = row.getValue("Y_COORDINA") # Double         bufValue = int(gp.GetCount_management(inMemoryLyr).getOutput(0)) # Integer     except:         gp.AddWarning("Acquire attributes failed")              lstResult = [pntID, pntX, pntY, bufValue]     lstOutput.append(lstResult)


I create a FeatureLayer (5.5 million points) in memory and load another FeatureClass (38.000 points) into memory.
Then I want to loop trough the 38.000 points (create cursor etc.). It doesn't matter if I write inMemoryKKH or row as input for the "select_features" in the SelectLayerByLocation function.
It always fails with something like: <geoprocessing row object object at 0x15A94F38>

It would be really nice if some of you could help me out here.

Bests Thomas

Outcomes