How to use the @conveyal/lonlat.toLeaflet 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 / components / map / draggable-popup.js View on Github external
render () {
    // remove and drag aren't used here but they shouldn't be passed into the popup
    const {position, children, remove, drag, dragEnd, ...rest} = this.props

    return (
      <span>
        </span>
    )
  }
github ibi-group / datatools-ui / lib / editor / actions / map / stopStrategies.js View on Github external
.then(result =&gt; {
          const newStopLatLngs = []
          // Iterate over newly added controlPoints and create stops for each.
          for (let i = controlPoints.length; i &lt; result.controlPoints.length; i++) {
            const controlPoint = result.controlPoints[i]
            const stopLatlng = ll.toLeaflet(controlPoint.point.geometry.coordinates)
            newStopLatLngs.push(stopLatlng)
          }
          // Create new stops at the interval points.
          return Promise.all(newStopLatLngs.map((latlng, i) =&gt; dispatch(
            addStopAtPoint(latlng, false, patternStops.length + i, activePattern))
          ))
            .then(newStops =&gt; {
              newStops.forEach((s, index) =&gt; {
                // Add new stop to pattern stops list
                if (s) {
                  const stopControlPoint = result.controlPoints[controlPoints.length + index]
                  const patternStop = stopToPatternStop(s)
                  // Set pattern stop's shape dist traveled.
                  patternStop.shapeDistTraveled = stopControlPoint.distance
                  patternStops.push(patternStop)
                  // Update stop properties on new control points.
github conveyal / taui / src / actions / data.js View on Github external
function getPointForLonLat (position, currentZoom: number, query) {
  const pixel = Leaflet.CRS.EPSG3857.latLngToPoint(
    lonlat.toLeaflet(position),
    currentZoom
  )
  const scale = Math.pow(2, query.zoom - currentZoom)

  let {x, y} = pixel
  x = x * scale - query.west | 0
  y = y * scale - query.north | 0

  return {x, y}
}
github ibi-group / datatools-ui / lib / editor / util / map.js View on Github external
export function getPatternEndPoint (pattern: Pattern, controlPoints?: Array): LatLng {
  let endPoint
  if (controlPoints &amp;&amp; controlPoints.length &gt; 0) {
    const lastControlPoint = controlPoints[controlPoints.length - 1]
    if (lastControlPoint.point) {
      endPoint = ll.toLeaflet(lastControlPoint.point.geometry.coordinates)
      return endPoint
    }
  }
  throw new Error('Control point is missing coordinates')
}
github conveyal / taui / src / actions / data.js View on Github external
dispatch(geocode(qs.end, (feature) => {
        const position = lonlat(feature.center)
        dispatch([
          setEnd({
            label: qs.end,
            position: lonlat(feature.center)
          }),
          fetchDestinationDataForLonLat(position)
        ])

        if (!qs.start) {
          dispatch(updateMap({centerCoordinates: lonlat.toLeaflet(feature.center)}))
        }
      }))
    }
github conveyal / analysis-ui / lib / utils / bounds.js View on Github external
export function reprojectBounds (bounds: LatLngBounds) {
  return new LatLngBounds(
    lonlat.toLeaflet(reprojectCoordinates(bounds.getSouthWest())),
    lonlat.toLeaflet(reprojectCoordinates(bounds.getNorthEast()))
  )
}
github conveyal / analysis-ui / lib / components / map / edit-bounds.js View on Github external
const onDragEnd = oppositeCorner => e => {
    p.save(
      fromLatLngBounds(
        new L.LatLngBounds(
          lonlat.toLeaflet(reprojectCoordinates(e.target.getLatLng())),
          oppositeCorner
        )
      )
    )
  }