ScottB

Using in_memory

Discussion created by ScottB on Oct 26, 2011
Latest reply on Oct 27, 2011 by csny490
I want to build my input table in memory to help speed the geocoding process up. However, when I try it tells me the table does not exsist. What am I doing wrong?

import arcpy

Input_address = arcpy.GetParameterAsText(0)
Input_city = arcpy.GetParameterAsText(1)
Input_state = arcpy.GetParameterAsText(2)
Input_zip = arcpy.GetParameterAsText(3)

address = Input_address
city = Input_city
state = Input_state
zipcode = Input_zip
print address + ', ' + city + ', ' + state, zipcode

#Table Creation
Distance_gdb = 'in_memory\\'
Test_DB = Distance_gdb + '\\temp.dbf'

arcpy.CreateTable_management(Distance_gdb, "temp.dbf", "", "")
arcpy.AddField_management(Test_DB, "address", "TEXT", "", "", "", "", "NON_NULLABLE", "REQUIRED", "")
arcpy.AddField_management(Test_DB, "city", "TEXT", "", "", "", "", "NON_NULLABLE", "NON_REQUIRED", "")
arcpy.AddField_management(Test_DB, "state", "TEXT", "", "", "", "", "NON_NULLABLE", "NON_REQUIRED", "")
arcpy.AddField_management(Test_DB, "zipcode", "TEXT", "", "", "", "", "NULLABLE", "NON_REQUIRED", "")

Add_field = 'address'
City_field = 'city'
state_field = 'state'
zip_field = 'zipcode'

#Table populate
cur = arcpy.InsertCursor(Test_DB)
row = cur.newRow()
row.setValue(Add_field, address)
row.setValue(City_field, city)
row.setValue(state_field, state)
row.setValue(zip_field, zipcode)
cur.insertRow(row)

#Geocode 
Input_Table = Test_DB 
US_StreetAddress_Enhanced = "Z:\\NewYork\\US_StreetAddress_Enhanced" #Locator
Geo_Address = 'in_memory\\Geo_Point' #Geocoded results
arcpy.GeocodeAddresses_geocoding(Input_Table, US_StreetAddress_Enhanced, "Street address VISIBLE NONE;City City VISIBLE NONE;State State VISIBLE NONE;ZIP zipcode VISIBLE NONE", Geo_Address, "STATIC")


The table creation works fine but the Add Field fails

arcgisscripting.ExecuteError: Failed to execute. Parameters are not valid.
ERROR 000732: Input Table: Dataset in_memory\\temp.dbf does not exist or is not supported
Failed to execute (AddField).

Outcomes