---
title: "simplifyPath | JavaScript maps SDK"
description: "Documentation for MapTiler SDK"
---

> For AI agents: a documentation index is available at [/llms.txt](https://docs.maptiler.com/llms.txt). Markdown versions of all pages are available by appending .md to any URL.

# Function simplifyPath

-   simplifyPath(points: \[number, number\]\[\], distance: number): \[number, number\]\[\][](#simplifypath)
    
    Simplfies a path by removing points that are too close together.
    
    This function first resamples the path based on the average distance between points, then filters out points that are closer than the specified distance from the last included point. The first and last points of the original path are always preserved.
    
    #### Parameters
    
    -   points: \[number, number\]\[\]
        
        An array of coordinate pairs \[longitude, latitude\]
        
    -   distance: number
        
        The minimum distance between points in the simplified path
        
    
    #### Returns \[number, number\]\[\]
    
    A new array containing a simplified version of the input path
