Select to view content in your preferred language

Need a work around since arcpy.conversion.FeatureToRaster doesn't put values in the "Value" field in the output raster

251
3
Jump to solution
05-14-2025 01:58 PM
AmyKeister
Emerging Contributor

I am converting a polygon to a raster, using a field that I will later do some calculations on further down in my analysis. In the old  PolylineToRaster and PolygonToRaster commands, they would take the values from the field I choose, and use them to populate the "Value" field in the output raster. In the new arcpy.conversion.FeatureToRaster command, instead of putting the values I want to calculate on in the "Value" field in the resulting raster, this tool is pulling the values in an extra raster field that has the same name as the field from the polygon it was created from.

I can't figure out the syntax to call on that field when I do processes on it later in the analysis. My work around has been to do an extra step of reclassifying the output raster, to create a raster with the values I want in the "Value" field. This causes extra processing time.

Can someone help me with the syntax to do analysis on the raster's field that is not the "Value" field. For example, I need to do cell statistics on several rasters that were created from vectors and I've tried a couple of ways to try to grab that other attribute, but haven't found the way that works. I tried searching the forums, but I only found old posts about the raster calculator old dot notation syntax, which doesn't work:

arcpy.sa.CellStatistics(["[R1000].raster1000","[R100].raster100","R10].raster10"], "SUM","DATA","SINGLE_BAND")

In this example I have a raster saved in a geodatabase named R1000 and the PolygonToRaster tool put my values in an extra "raster1000" field instead of the "Value" field.

Thanks!

 

0 Kudos
1 Solution

Accepted Solutions
DanPatterson
MVP Esteemed Contributor

PolygonToRaster still exists

Polygon to Raster (Conversion)—ArcGIS Pro | Documentation

is there a reason you want to use FeatureToRaster?


... sort of retired...

View solution in original post

0 Kudos
3 Replies
DanPatterson
MVP Esteemed Contributor

PolygonToRaster still exists

Polygon to Raster (Conversion)—ArcGIS Pro | Documentation

is there a reason you want to use FeatureToRaster?


... sort of retired...
0 Kudos
AmyKeister
Emerging Contributor

Oh, Thank you! I thought it was discontinued. A friend had mentioned it was going away and I needed to switch to the new one. haha. Problem solved!

0 Kudos
Luke_Pinner
MVP Regular Contributor

A workaround could be to use arcpy.sa.Lookup if you don't want to continue using PolygonToRaster.

0 Kudos