Skip to content

Latest commit

 

History

History
56 lines (43 loc) · 1.42 KB

File metadata and controls

56 lines (43 loc) · 1.42 KB

💚 This is the latest document.

spherical.computeOffsetOrigin()

Returns the location of origin when provided with a LatLng destination, meters travelled and original heading. Headings are expressed in degrees clockwise from North. This function returns null when no solution is available.

plugin.google.maps.geometry.spherical.computeOffsetOrigin(to, distance, heading);

Parameters

name type description
to ILatLng to position
distance number distance in meter
heading number heading (expressed in degrees clockwise from north)

Demo code

<div id="map_canvas"></div>
var center = {"lat": 32, "lng": -97};

// radius (meter)
var radius = 300;

// Calculate the positions
var offsets = [];
for (var degree = 0; degree < 360; degree += 45) {
    offsets.push(plugin.google.maps.geometry.spherical.computeOffsetOrigin(center, radius, degree));
}

var mapDiv = document.getElementById("map_canvas");
var map = plugin.google.maps.Map.getMap(mapDiv, {
  camera: {
    target: offsets,
    padding: 100
  }
});

offsets.forEach(function(offset) {
  map.addPolyline({
    'points': [center, offset],
    'color' : '#AA00FF'
  });
});