python - feature to raster conversion  please help!

389
1
09-09-2011 05:10 AM
KateWalker
New Contributor
Hi,
I have got 530 features from 4 geodabases to convert to rasters, so using python should be the quickest way.  However, after successfully converting 20 of them, Arc kept giving me an error saying that the grid name was too long, it wasn't but to work around this I created a different destination folder so that the address of the destination folder fitted on one line (I think Arc was having a hissy fit because the address ran over two lines!).  In any case, I am now getting a big error box called 'background processing' appearing when I try to run my script, which informs me that 'background processing has encountered a serious error and is unable to continue' - any ideas or suggestions gratefully received as I cant face using the toolbox to do this for me, 530 times.  Oh, and if I convert to raster using the toolbox it works fine!
The python script I have been using is:
import arcpy
from arcpy import env
env.workspace = "c:\Users\User\Documents\PESERA\Conwy\Conwy.mdb"
arcpy.FeatureToRaster_conversion("Conwy_PESERA", "newtemp1", "c:\Users\User\Documents\PESERA\Conw\newtemp1", 100)

Thanks,
Kate
Tags (2)
0 Kudos
1 Reply
George_ChandeepCorea
New Contributor III
Hi Kate,

You have to add a little more to your script. The issue is that the file name, not the directory to it is more than 13 characters. So you have to truncate the name. You have to look at your files and see if there is something common in the names that you can eleminate or you will have to simply call them 1-530 and generate a csv which has the old name and new name.

If I can get a file list from you I can see what exactly can be done - but the following code should help (structure wise).

best,
0 Kudos