# Problem about converting raster to polyline and calculating total length

I have raster file of line segment. I need to convert it to line and get the distance of that line. How can i do using Python and ArcGIS 10? I have tried with GIS tools Convert Raster to Polyline but the line segment is not straight and it is divided into no of segments, isn't it possible to get single line segment.

I have attached herewith pictures. My problem is to find out the width of dam. For that I have drawn cross section at a regular interval along the stream. I have also shown how I will find out the width.. If you have any suggestion please provide me. And talking about my problem, after raster analysis of taking the difference of two raster. I have a raster segment shown in right side of picture. I tried to Convert Raster to Polyline but line is not straight and break into several segment. I need to have one line segment which is straight.

• Could you post a screenshot so we have a better understanding of the problem?
– Aaron
Commented May 26, 2013 at 14:48
• I have attached picture for the better understanding of my problem. Please provide me some guidance in this matter. Commented May 26, 2013 at 15:43
• How is the image to the right flawed? To me it appears as if Raster to Line worked properly. Could you also please define "...it is divided into no of segments..."? Thanks for the clarifications
– Aaron
Commented May 26, 2013 at 16:00
• When I convert raster into Polyline. It is converted into several segments with short distances. Is it possible to make only one segment so that I can get width directly ? Commented May 26, 2013 at 16:10
• Why not just apply the ruler tool to read off the length(s)? If you need an automated solution, it's often more reliable to convert the shape to a polygon, compute its centerline, and obtain that length. Commented Jun 12, 2013 at 15:56

If you want a programmatic solution, you could use `arcpy.sa.Thin` and then `RasterToPolyline`.
Found a few things on the centerline from a polygon idea (e.g., `http://resources.arcgis.com/en/help/main/10.1/index.html#//010n00000019000000`), but still sounds kind of involved.