How to use the arc.GreatCircle function in arc

To help you get started, we’ve selected a few arc 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 nasa-gibs / worldview / web / js / map / measure / util.js View on Github external
const getArcLine = (p1, p2) => {
// The number of additional coordinate points to add to a LineString when
// converting it to conform to a great circle arc.
  const arcLineResolution = 50;
  const start = { x: p1[0], y: p1[1] };
  const end = { x: p2[0], y: p2[1] };
  const arcGen = new arc.GreatCircle(start, end);
  return arcGen.Arc(arcLineResolution, { offset: 10 });
};
github springmeyer / arc.js / example / csv2arc.js View on Github external
// likely a float
               att_value = parseFloat(att_value);
            }
        } else {
            // if it is a quoted string, strip quotes
            var f = att_value.charAt(0);
            var l = att_value.charAt(-0);
            if ((f == "\"" && l == "\"") || (f == "\'" && l == "\'")) {
               att_value = att_value.slice(1,-1).trim();
            }        
        }
        properties[name.trim()] = att_value;
    });
    
    // now actually form up the GreatCircle object
    var gc = new arc.GreatCircle(start, end, properties);

    // build out a linestring with 10 intermediate points
    var line = gc.Arc(10);
    
    // add this line to the json features
    features.push(line.json());
});
github node-geojson / openflights-geojson / routes.js View on Github external
var geometry;
                    if (!(airports[row.dst_id] && airports[row.src_id])) {
                        return cb();
                    }
                    if (row.dst_id === row.src_id) {
                        return cb();
                    }
                    if ([
                        airports[row.dst_id].lng,
                        airports[row.dst_id].lat,
                        airports[row.src_id].lat,
                        airports[row.src_id].lng].some(isNaN)) {
                        throw new Error('bad coord');
                    }
                    if (argv.arc) {
                        geometry = (new arc.GreatCircle({
                            x: parseFloat(airports[row.src_id].lng),
                            y: parseFloat(airports[row.src_id].lat)
                        }, {
                            x: parseFloat(airports[row.dst_id].lng),
                            y: parseFloat(airports[row.dst_id].lat)
                        })).Arc(50).json().geometry;
                    } else {
                        geometry = {
                            type: 'LineString',
                            coordinates: [
                                [ parseFloat(airports[row.src_id].lng),
                                  parseFloat(airports[row.src_id].lat) ],
                                [ parseFloat(airports[row.dst_id].lng),
                                  parseFloat(airports[row.dst_id].lat) ]
                            ]
                        };
github chelm / grunt-geo / tasks / geo.js View on Github external
points.forEach(function( p ){
        if ( !p.center ){
          var start = new arc.Coord( p.lng, p.lat );
          var end = new arc.Coord( centerPoint.lng, centerPoint.lat );
          var gc = new arc.GreatCircle( start, end, { 'marker-color': '#555555'} );
          var line = gc.Arc(20);
          lines.push(line.json());
        }
      });
      callback();