How to use the turf.destination function in turf

To help you get started, we’ve selected a few turf 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 mapbox / cheap-ruler / bench / bench-buffer-point.js View on Github external
function bboxBuffer(pt, distance) {
    var sw = turf.destination(pt, distance, -135);
    var ne = turf.destination(pt, distance, 45);
    return sw.geometry.coordinates.concat(ne.geometry.coordinates);
}
github mapbox / cheap-ruler / bench / bench-buffer-point.js View on Github external
function bboxBuffer(pt, distance) {
    var sw = turf.destination(pt, distance, -135);
    var ne = turf.destination(pt, distance, 45);
    return sw.geometry.coordinates.concat(ne.geometry.coordinates);
}
github mapbox / osm-sidewalker / sidewalker.js View on Github external
segmented.features.forEach(function (segment) {
    var seglen = segment.geometry.coordinates.length;
    var endpoint = turf.point(segment.geometry.coordinates[seglen - 1]);
    var bearing = turf.bearing(
      turf.point(segment.geometry.coordinates[seglen - 2]), endpoint);

    var start = turf.destination(endpoint, 75/5280, bearing - 90, 'miles');
    var end = turf.destination(endpoint, 75/5280, bearing + 90, 'miles');
    bisectors.push(turf.linestring([start.geometry.coordinates, end.geometry.coordinates]));
  });
github probr / probr-analysis / worker / components / location / location.foreach.js View on Github external
function locationToCircle(loc, multiplier) {
      var point = turf.point([loc.long,loc.lat]);
      var distance = signalToMeters(loc.weightedSignal, multiplier);

      var coordinates = [];
      for (var i=0; i<=360; i+=10) {
        coordinates.push( turf.destination(point, distance/1000, i, 'kilometers').geometry.coordinates );
      }
      var poly = turf.polygon([coordinates]);
      return poly;
    }
github mapbox / osm-sidewalker / sidewalker.js View on Github external
segmented.features.forEach(function (segment) {
    var seglen = segment.geometry.coordinates.length;
    var endpoint = turf.point(segment.geometry.coordinates[seglen - 1]);
    var bearing = turf.bearing(
      turf.point(segment.geometry.coordinates[seglen - 2]), endpoint);

    var start = turf.destination(endpoint, 75/5280, bearing - 90, 'miles');
    var end = turf.destination(endpoint, 75/5280, bearing + 90, 'miles');
    bisectors.push(turf.linestring([start.geometry.coordinates, end.geometry.coordinates]));
  });
github mapbox / cheap-ruler / bench / bench-destination.js View on Github external
'turf.destination': function () {
        for (var i = 0; i < points.length; i++) {
            turf.destination(turf.point(points[i]), 1, (i % 360) - 180, 'kilometers');
        }
    },
    'ruler.destination': function () {