1

I am trying to convert a polygon feature class (created intermediately as part of a larger process) to a raster, which will have the same snap settings and cell size as another input raster. However, every time i try to run it, I get this error:

ExecuteError: ERROR 000918: Cannot retrieve feature class extent.

I cannot find any help on this issue and I don't know what to do. I have already seen this question and it did not help resolve the issue.

This is the code:

cell_size = float(GetRasterProperties(in_raster, 'CELLSIZEX').getOutput(0))

env.snapRaster = in_raster

PolygonToRaster(buffer_fc, z_field_name, stamp_raster, cellsize=cell_size)

return None

The same parameters work when I execute "Polygon To Raster" diretly from the ArcToolbox GUI.

2
  • Is it possible that your feature class is being locked by a prior process? – MaryBeth Feb 10 '17 at 14:29
  • It's the output of MultipleRingBuffer. Is there a way for me to check if it's being locked directly? EDIT: Yes it seems that it is being locked, because arcpy.TestSchemaLock(fc) is returning "1" – wfgeo Feb 10 '17 at 14:32
1

Thanks to MaryBeth for suggesting that it was a schema lock issue. By running arcpy.TestSchemaLock() on the feature class that I was trying to convert to raster (buffer_fc), I saw that it was being locked, which was preventing PolygonToRaster() from acquiring its extent and therefore failing. Apparently, MultipleRingBuffer() has some locking issues (that was where buffer_fc came from). I used arcpy.CopyFeatures() to copy it to a new dataset and then ran PolygonToRaster() on that instead, and it worked perfectly.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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