## Summary

Smooths sharp angles in lines to improve aesthetic or cartographic quality.

## Illustration

## Usage

There are two smoothing methods to choose from:

- The Polynomial Approximation with Exponential Kernel (PAEK) method (PAEK in Python) smooths lines based on a smoothing tolerance. Each smoothed line may have more vertices than its source line. The Smoothing Tolerance parameter controls the length of a "moving" path used in calculating the new vertices. The shorter the length the more detail that will be preserved and the longer the processing time.
- The Bezier interpolation method (BEZIER_INTERPOLATION in Python) smooths lines without using a tolerance by creating Bezier curves to match the input lines. If the output is a shapefile, the Bezier curves will be approximated, since true Bezier curves cannot be storied in shapefiles.

Smoothing may introduce topological errors such as line crossings. Use the Flag errors option (FLAG_ERRORS in Python) in the Handle Topological Errors parameter to identify these errors. Two fields will be added—InLine_FID and SmoLnFlag—to contain input feature IDs and topological errors. Values of 1 in the SmoLnFlag field indicate a topology error; 0 (zero) indicates no error. The InLineFID field links the output lines to their input lines. The Flag errors option cannot be used within an edit session.

Invalid (self-intersecting) geometry may be created during the smoothing process and will be repaired but not improved. For example, if a line self-crosses it will become a multipart line but will still appear self-crossing.

## Syntax

SmoothLine_cartography (in_features, out_feature_class, algorithm, tolerance, {endpoint_option}, {error_option})

Parameter | Explanation | Data Type |

in_features | The line features to be smoothed. | Feature Layer |

out_feature_class | The output feature class to be created. | Feature Class |

algorithm | Specifies the smoothing algorithm. - PAEK —Acronym for Polynomial Approximation with Exponential Kernel. It calculates a smoothed line that will not pass through the input line vertices. This is the default.
- BEZIER_INTERPOLATION —Fits Bezier curves between vertices. The resulting line passes through the vertices of the input line. This algorithm does not require a tolerance. Bezier curves will be approximated in shapefile output.
| String |

tolerance | Sets a tolerance used by the PAEK algorithm. A tolerance must be specified, and it must be greater than zero. You can choose a preferred unit; the default is the feature unit. You must enter a 0 as a placeholder when using the BEZIER_INTERPOLATION smoothing algorithm. | Linear unit |

endpoint_option (Optional) | Specifies whether to preserve the endpoints for closed lines. This option works with the PAEK algorithm only. - FIXED_CLOSED_ENDPOINT —Preserves the endpoint of a closed line. This is the default.
- NO_FIXED —Smooths through the endpoint of a closed line.
| Boolean |

error_option (Optional) | Specifies how the topological errors (possibly introduced in the process, such as line crossing) will be handled. - NO_CHECK —Specifies not to check for topological errors. This is the default.
- FLAG_ERRORS —Specifies to flag topological errors, if any are found.
| String |

## Code Sample

##### SmoothLine Example (Python Window)

The following Python window script demonstrates how to use the SmoothLine tool in immediate mode.

```
import arcpy
from arcpy import env
import arcpy.cartography as CA
env.workspace = "C:/data"
CA.SmoothLine("contours.shp", "C:/output/output.gdb/smoothed_contours", "PAEK", 100)
```

##### SmoothLine Example 2 (stand-alone script)

The following stand-alone script demonstrates how to use the SmoothLine tool.

```
# Name: SmoothLine_Example2.py
# Description: Simplify and then Smooth coastlines
# Import system modules
import arcpy
from arcpy import env
import arcpy.cartography as CA
# Set environment settings
env.workspace = "C:/data/Portland.gdb/Hydrography"
# Set local variables
inCoastlineFeatures = "coastlines"
simplifiedFeatures = "C:/data/PortlandOutput.gdb/coastlines_simplified"
smoothedFeatures = "C:/data/PortlandOutput.gdb/coastlines_smoothed"
# Simplify coastlines.
CA.SimplifyLine(inCoastlineFeatures, simplifiedFeatures, "POINT_REMOVE", 50, "RESOLVE_ERRORS", "KEEP_COLLAPSED_POINTS", "CHECK")
# Smooth coastlines.
CA.SmoothLine(simplifiedFeatures, smoothedFeatures, "PAEK", 100, "", "FLAG_ERRORS")
```

## Environments

## Licensing Information

- ArcGIS for Desktop Basic: No
- ArcGIS for Desktop Standard: Yes
- ArcGIS for Desktop Advanced: Yes