sharedstreets / sharedstreets-js

SharedStreets (Node.js & Javascript)
https://sharedstreets.io
MIT License
78 stars 25 forks source link

Add geometry method to core js library #12

Closed DenisCarriere closed 6 years ago

DenisCarriere commented 6 years ago

Add geometry method to core js library

Pulled from sharedstreets-conflator, core methods such as geometry & others core methods should be included in the main sharedstreets-js library.

js example

const line = [[110, 45], [115, 50], [120, 55]];
const geom = sharedstreets.geometry(line);
geom.id; // => "ce9c0ec1472c0a8bab3190ab075e9b21"
geom.lonlats; // => [ 110, 45, 115, 50, 120, 55 ]

output

{
    backReferenceId: "197cb60a06518f4d616fea25b5e81266",
    forwardReferenceId: "79aad7fa7e4fec23ff2c97d0b33086ce",
    fromIntersectionId: "71f34691f182a467137b3d37265cb3b6",
    id: "ce9c0ec1472c0a8bab3190ab075e9b21",
    lonlats: [ 110, 45, 115, 50, 120, 55 ],
    roadClass: "Other",
    toIntersectionId: "42286ee839cf23904b00acfc7d13a2e2",
  }