How to use the @conveyal/lonlat.toString 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 / taui / src / actions / config.js View on Github external
...request,
          ready: true,
          transitive
        }
      })

      // Set all the networks
      fullNetworks.forEach(n => dispatch(setNetwork(n)))

      try {
        // Load the config start coordinate or the center
        const centerFromMap = get(map, 'centerCoordinates', getCenterFromNetwork(fullNetworks[0]))
        const centerCoordinates = startCoordinate || centerFromMap

        const geocoder = {
          proximity: lonlat.toString(centerFromMap)
        }
        const maxBounds = get(map, 'maxBounds')
        if (maxBounds) {
          geocoder.bbox = typeof maxBounds === 'string'
            ? maxBounds
            : `${maxBounds[0].join(',')},${maxBounds[1].join(',')}`
        }

        dispatch({type: 'set geocoder', payload: geocoder})
        dispatch(updateStartPosition(centerCoordinates))
      } catch (e) {
        console.error(e)
      }
    }
  }))
github conveyal / taui / src / selectors / network-routes.js View on Github external
  (n, e, i, s) => `${n.name}-${i}-${lonlat.toString(s)}-${lonlat.toString(e)}`
)
github conveyal / analysis-ui / lib / components / map / geocoder.js View on Github external
function searchWithProximity(t, callback) {
    const map = p.getMap()
    mapboxSearch(
      t,
      {
        proximity: map ? lonlat.toString(map.getCenter()) : ''
      },
      callback
    )
  }
github conveyal / analysis-ui / lib / components / analysis / index.js View on Github external
disableMarker={disableInputs}
          markerPosition={p.profileRequestLonLat}
          markerTooltip={
            !p.currentProject ? message('analysis.disableFetch') : undefined
          }
          setDestination={p.setDestination}
          setOrigin={this._setOrigin}
        />

        {this.state.showBoundsEditor && (
          
        )}

        {displayedDataIsCurrent && p.destination && (
          
        )}
      
    ))
  }
github conveyal / analysis-ui / lib / components / map / isochrone.js View on Github external
data={comparisonIsochrone}
            key={`isochrone-comparison-${isochroneCutoff}-${lonlat.toString(isochroneLonLat)}${isochroneIsStale ? '-dim' : ''}`}
            style={{
              fillColor: isochroneIsStale
                ? colors.STALE_ISOCHRONE_COLOR
                : colors.COMPARISON_ISOCHRONE_COLOR,
              opacity: 0.65,
              pointerEvents: 'none',
              stroke: false
            }}
          />}

        {isochrone &&
          }
      
    )
  }
github conveyal / taui / src / components / application.js View on Github external
_downloadIsochrone = memoize(index => () => {
    const p = this.props
    const isochrone = p.isochrones[index]
    if (isochrone) {
      const name = p.networks[index].name
      const ll = lonlat.toString(p.start.position)
      downloadJson({
        data: isochrone,
        filename: `${name}-${ll}-${p.timeCutoff}min-isochrone.json`
      })
    } else {
      window.alert('No isochrone has been generated for this network.')
    }
  })
github conveyal / taui / src / actions / map.js View on Github external
export function updateMap (payload) {
  if (payload.zoom) {
    setKeyTo('zoom', payload.zoom)
  }

  if (payload.centerCoordinates) {
    setKeyTo(
      'centerCoordinates',
      lonlat.toString(payload.centerCoordinates)
    )
  }

  return {
    type: 'update map',
    payload
  }
}
github conveyal / taui / src / utils / get-isochrone-for-network.js View on Github external
  (n, c, s, pi) => `${n.name}-${lonlat.toString(s.position)}-${c}-${pi}`
)