How to use the wkx.LineString function in wkx

To help you get started, we’ve selected a few wkx examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github codice / ddf / ui / packages / catalog-ui-search / src / main / webapp / component / location-new / utils / dms-utils.js View on Github external
}

  let wkt = null
  const points = []
  switch (dms.shape) {
    case 'point':
      wkt = dmsPointToWkt(dms.point).toWkt()
      break
    case 'circle':
      const distance = toKilometers(dms.circle.radius, dms.circle.units)
      wkt = computeCircle(dmsPointToWkt(dms.circle.point), distance, 36).toWkt()
      break
    case 'line':
      if (dms.line.list.length > 0) {
        dms.line.list.map(point => points.push(dmsPointToWkt(point)))
        wkt = new wkx.LineString(points).toWkt()
      }
      break
    case 'polygon':
      if (dms.polygon.list.length > 0) {
        dms.polygon.list.map(point => points.push(dmsPointToWkt(point)))
        const p1 = points[0]
        const p2 = points[points.length - 1]
        if (p1.x !== p2.x || p1.y !== p2.y) {
          points.push(new wkx.Point(p1.x, p1.y))
        }
        wkt = new wkx.Polygon(points).toWkt()
      }
      break
    case 'boundingbox':
      const nw = {
        latitude: dms.boundingbox.north,
github codice / ddf / ui / packages / catalog-ui-search / src / main / webapp / component / location-new / utils / usng-utils.js View on Github external
switch (usng.shape) {
    case 'point':
      wkt = usngGridToWktPoint(usng.point).toWkt()
      break
    case 'circle':
      const distance = toKilometers(usng.circle.radius, usng.circle.units)
      wkt = computeCircle(
        usngGridToWktPoint(usng.circle.point),
        distance,
        36
      ).toWkt()
      break
    case 'line':
      if (usng.line.list.length > 0) {
        usng.line.list.map(grid => points.push(usngGridToWktPoint(grid)))
        wkt = new wkx.LineString(points).toWkt()
      }
      break
    case 'polygon':
      if (usng.polygon.list.length > 0) {
        usng.polygon.list.map(grid => points.push(usngGridToWktPoint(grid)))
        const p1 = points[0]
        const p2 = points[points.length - 1]
        if (p1.x !== p2.x || p1.y !== p2.y) {
          points.push(new wkx.Point(p1.x, p1.y))
        }
        wkt = new wkx.Polygon(points).toWkt()
      }
      break
    case 'boundingbox':
      const grid = converter.isUSNG(usng.boundingbox)
      const bbox = converter.USNGtoLL(grid, false)
github codice / ddf / ui / packages / catalog-ui-search / src / main / webapp / component / location-new / utils / dd-utils.js View on Github external
}

  let wkt = null
  const points = []
  switch (dd.shape) {
    case 'point':
      wkt = ddPointToWkt(dd.point).toWkt()
      break
    case 'circle':
      const distance = toKilometers(dd.circle.radius, dd.circle.units)
      wkt = computeCircle(ddPointToWkt(dd.circle.point), distance, 36).toWkt()
      break
    case 'line':
      if (dd.line.list.length > 0) {
        dd.line.list.map(point => points.push(ddPointToWkt(point)))
        wkt = new wkx.LineString(points).toWkt()
      }
      break
    case 'polygon':
      if (dd.polygon.list.length > 0) {
        dd.polygon.list.map(point => points.push(ddPointToWkt(point)))
        const p1 = points[0]
        const p2 = points[points.length - 1]
        if (p1.x !== p2.x || p1.y !== p2.y) {
          points.push(new wkx.Point(p1.x, p1.y))
        }
        wkt = new wkx.Polygon(points).toWkt()
      }
      break
    case 'boundingbox':
      const nw = new wkx.Point(dd.boundingbox.west, dd.boundingbox.north)
      const ne = new wkx.Point(dd.boundingbox.east, dd.boundingbox.north)

wkx

A WKT/WKB/EWKT/EWKB/TWKB/GeoJSON parser and serializer

MIT
Latest version published 5 years ago

Package Health Score

67 / 100
Full package analysis