0

I have a polyline shapefile of streams that I am attempting to convert to a raster using the "Polyline to Raster" conversion tool. However, rather than outputting a raster with distinct stream pixels, my output is a seemingly empty raster with a greyscale value scale of 0 to 255. My methodology is as follows:

1) I have created a field within "streams" called "rastervalue"
2) I assigned values of "1" to each stream feature in hope that all stream pixels within my output raster are represented by this value.
3) I ran "Polyline to Raster" using the following script:

    arcpy.PolylineToRaster_conversion(Streams,"rastervalue")

I have attempted this with varying cell sizes, and my results seem to be the same. How can I generate the desired output?

  • 1
    Have you tried playing around with the symbology of your raster? If the cell values are 1 for streams, and 0 or NoData for the rest, the default display with greyscale 0-255 may appear uniform. Maybe you could also try setting the value to 255 and check out the results. – FSimardGIS Dec 5 '18 at 22:37
  • @FSimardGIS I have played around with it. I tried to display the results categorically, but it seems like there aren't any values to add. – Ashton Dec 5 '18 at 22:39
  • What is the field type of your values? – FSimardGIS Dec 5 '18 at 22:41
  • My "rastervalue" field is a short integer. – Ashton Dec 5 '18 at 22:42
  • 1
    Set up environment extent and cell size . – FelixIP Dec 5 '18 at 23:57
1

The issue is with the Cellsize input. When I tested the tool the default was quite large. Reduce the Cellsize value to something that suits your data. Here I have lines that are several hundred feet in length. I made my Cellsize 100 to create a rough raster representation of my lines.

enter image description here

arcpy.PolylineToRaster_conversion(Streams,"rastervalue", cellsize = 100)

  • As mentioned in my original post, I have set various cell sizes. I have tried large and small values, and the default value that the toolbox UI suggests. I still get the same result... – Ashton Dec 6 '18 at 17:44
  • Ah sorry, I'm a skimmer. What's the Linear Unit of your input polyline feature class? (Properties -> Source or XY Coordinate System) – Emil Brundage Dec 6 '18 at 17:52
  • No worries :) The linear units are US Feet. – Ashton Dec 6 '18 at 17:58
  • Actually, I think you were correct after all! The UI shows a default value in feet, but it looks like it actually converts it to decimal degrees?? (I'm not sure if this is a default or if it is because my dataframe is set to decimal degrees). So, the values that I thought were small, were actually not small at all. Once I choose an appropriate cell size in decimal degrees, I get my desired results. Thank you for getting me to look at this some more. – Ashton Dec 6 '18 at 18:07
  • Being a skimmer pays off once again! – Emil Brundage Dec 6 '18 at 18:14

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.