Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import Coordinate from 'jsts/org/locationtech/jts/geom/Coordinate'
import GeometryFactory from 'jsts/org/locationtech/jts/geom/GeometryFactory'
import IsSimpleOp from 'jsts/org/locationtech/jts/operation/IsSimpleOp'
import RelateOp from 'jsts/org/locationtech/jts/operation/relate/RelateOp'
import DistanceOp from 'jsts/org/locationtech/jts/operation/distance/DistanceOp'
import Polygonizer from 'jsts/org/locationtech/jts/operation/polygonize/Polygonizer'
import BoundaryNodeRule from 'jsts/org/locationtech/jts/algorithm/BoundaryNodeRule'
import LengthIndexedLine from 'jsts/org/locationtech/jts/linearref/LengthIndexedLine'
const factory = new GeometryFactory()
const isSimpleOp = new IsSimpleOp()
function toLineString (coordinates) {
return factory.createLineString(coordinates.map(c => new Coordinate(c[0], c[1])))
}
function toCoordinate (c) {
return new Coordinate(c[0], c[1])
}
function toPoint (c) {
return factory.createPoint(new Coordinate(c[0], c[1]))
}
function polyToCoordss (poly) {
const cs = lineStringToCoords(poly.getExteriorRing())