---
title: "resamplePath | 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 resamplePath

-   resamplePath(path: \[number, number\]\[\], spacing?: number): \[number, number\]\[\][](#resamplepath)
    
    Resamples a geographic path to have points spaced at approximately equal distances. If the original path has fewer than 2 points, it is returned unchanged.
    
    #### Parameters
    
    -   path: \[number, number\]\[\]
        
        An array of coordinate pairs \[longitude, latitude\] representing the path to resample
        
    -   spacing: number = 10
        
        The desired spacing between points in the resampled path (in the same unit as used by the distanceTo method), defaults to 10
        
    
    #### Returns \[number, number\]\[\]
    
    A new array of coordinate pairs representing the resampled path with approximately equal spacing between points
