Last active
June 23, 2017 13:01
-
-
Save pfirpfel/39b1868b8f885be0d854cbd3d4f81966 to your computer and use it in GitHub Desktop.
mergeLineStrings
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @param arr Array of LineStrings, see: https://tools.ietf.org/html/rfc7946#appendix-A.2 | |
* @returns LineString | |
*/ | |
function mergeLineStrings(arr){ | |
return { | |
type: 'LineString', | |
coordinates: arr.map(ls => ls.coordinates).reduce((acc, cur) => acc.concat(cur.slice(1))) | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment