How to use the @conveyal/lonlat.fromPixel function in @conveyal/lonlat

To help you get started, we’ve selected a few @conveyal/lonlat 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 conveyal / analysis-ui / lib / selectors / aggregation-area-outline.js View on Github external
project: ([x, y]) => {
      // - 1 due to increasing the grid size above
      const ll = lonlat.fromPixel(
        {
          x: x + west - 1,
          y: y + north - 1
        },
        zoom
      )
      return [ll.lon, ll.lat]
    },
    // Temporarily disabling interpolation because it causes issues near edges (PR with fix made to
github conveyal / analysis-ui / lib / components / analysis / advanced-settings.js View on Github external
function webMercatorBoundsToGeographic({north, west, width, height, zoom}) {
  const nw = lonlat.fromPixel(
    {
      x: west + 1,
      y: north
    },
    zoom
  )
  const se = lonlat.fromPixel(
    {
      x: west + width + 1,
      y: north + height
    },
    zoom
  )
  return {
    east: se.lon,
    north: nw.lat,
github conveyal / taui / src / utils / get-isochrone-for-network.js View on Github external
project([x, y]) {
      const {lon, lat} = lonlat.fromPixel(
        {
          x: x + surface.west,
          y: y + surface.north
        },
        surface.zoom
      )
      return [lon, lat]
    }
  })
github conveyal / analysis-ui / lib / components / analysis / advanced-settings.js View on Github external
function webMercatorBoundsToGeographic({north, west, width, height, zoom}) {
  const nw = lonlat.fromPixel(
    {
      x: west + 1,
      y: north
    },
    zoom
  )
  const se = lonlat.fromPixel(
    {
      x: west + width + 1,
      y: north + height
    },
    zoom
  )
  return {
    east: se.lon,
    north: nw.lat,
    south: se.lat,
    west: nw.lon
  }
}
github conveyal / analysis-ui / lib / actions / analysis / straight-line.js View on Github external
get (x, y) {
      const ll = lonlat.fromPixel({
        x: x + surface.west,
        y: y + surface.north
      }, surface.zoom)
      const distMeters = lonlat
        .toLeaflet(ll)
        .distanceTo(lonlat.toLeaflet(origin))

      const timeMinutes = (distMeters / 1000 / speedKmh * 60) | 0

      return Array(surface.depth).fill(timeMinutes)
    }
  }
github conveyal / taui / src / utils / coordinate-to-point.js View on Github external
export const pointToCoordinate = (x, y, zoom) =>
  lonlat.fromPixel({ x, y }, zoom)
github conveyal / analysis-ui / lib / utils / reproject-coordinates.js View on Github external
export default function reproject(ll) {
  const p = lonlat.toPixel(ll, Z)
  return lonlat.fromPixel(
    {
      x: Math.round(p.x),
      y: Math.round(p.y)
    },
    Z
  )
}