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

-   fromLineString(  
        ls: [LineString](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Externals.LineString/),  
        options?: [ElevationBatchOptions](https://docs.maptiler.com/sdk-js/api-reference/types/ElevationBatchOptions/),  
    ): Promise<[LineString](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Externals.LineString/)\>[](#fromlinestring)
    
    Creates a clone of a GeoJSON LineString (deep copy with structuredClone) that contains the computed elevation as the third element of each position array (\[lng, lat, alt\])
    
    #### Parameters
    
    -   ls: [LineString](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Externals.LineString/)
        
        A GeoJSON LineStriung feature
        
    -   `Optional`options: [ElevationBatchOptions](https://docs.maptiler.com/sdk-js/api-reference/types/ElevationBatchOptions/)
        
        Options
        
    
    #### Returns Promise<[LineString](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Externals.LineString/)\>
