4

I have a large dataset that I am working with. Basically I have a table with 900,000 records that I join to a geodatabase feature layer, then convert that to a raster.

This process takes a total of about 15 minutes if I do it manually in ArcMap.

When I write a python script for it, it takes over 40 minutes.

The table join and creating a feature layer part of my script works fairly quickly (about 2 minutes) but it gets hung up on the convert to raster.

This is the code I am using to convert to raster

arcpy.PolygonToRaster_conversion(polys_fl,"join_table.responses",outputimg,'','',10)

This script is imported into a toolbox. I'm not running it in an IDE.

6
  • Are you sure you are converting to a raster of the same cellsize and extent as before?
    – whuber
    Mar 7, 2013 at 23:29
  • I'm not sure the cellsize and extent should matter. There isn't any "before" really since I'm taking the polygon and converting it to raster. There was never a raster to start with. If I'm missing something let me know. Thanks!
    – Carson
    Mar 8, 2013 at 1:18
  • 1
    I would try exporting the joined dataset so that no join lookup is required during rasterization. This may be slower outside of ArcMap due to missing attribute indexes.
    – dmahr
    Mar 8, 2013 at 2:28
  • 3
    You said it takes longer in a script than in ArcMap. What whuber is asking is whether you are using the same cellsize and extent both in the script and when you do it manually. Cell size and extent have a major impact on processing speed because they dictate the volume of data being created (i.e. calculated and written to disk). Also remember that halving the cell size will quadruple the data volume, so you can rapidly balloon a raster, thus ramping up the processing times too. Mar 8, 2013 at 8:31
  • 1
    Thanks for the clarification. I for sure am using the same cell size both ways. I didn't do anything with the extent in either situation though. I figured it would automatically use the extent from the polygon in both scenarios (is this wrong to assume?).
    – Carson
    Mar 8, 2013 at 12:59

1 Answer 1

4

I got it figured out. I had to build the index for the join table. Doing this it actually made the program run even faster than doing it manually.

2
  • Excellent tip! The link in the comment by @dmahr above is a good reference on this.
    – ccn
    Mar 8, 2013 at 16:32
  • FYI, build the index on the join table BEFORE you do the join. I first tried to build the index for the resulting joined feature class but it didn't help.
    – Carson
    Mar 8, 2013 at 16:41

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.