Angle within a radius google maps [closed]
closed. this question is out of scope and is not currently accepting answers.
want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 7 months ago .
improve this questionI have a project using google maps, where I receive the latlng information (which will create a marker in this location), as well as radius and azimuth, knowing that the angle will always be 60°. How can I form an angle with the azimuth, within a radius that was created with google.maps.Circle around the marker?
I hope I have managed to express my doubt, to better exemplify I am leaving an image below.
0
Author: Luis Faconi, 2018-07-03
1 answers
My problem was solved through this mathematical calculation:
var latConv = google.maps.geometry.spherical.computeDistanceBetween(latlng, latlng1) / 1000;
var lngConv = google.maps.geometry.spherical.computeDistanceBetween(latlng, latlng2) / 1000;
var calcRaio = raio / 1000;
for (var i = (azimute - angulo / 2) ; i <= (azimute + angulo / 2) ; i += 2) {
var pint = new google.maps.LatLng(latlng.lat() + (calcRaio / latConv * Math.cos(i * Math.PI / 180)), latlng.lng() + (calcRaio / lngConv * Math.sin(i * Math.PI / 180)));
points.push(pint);
}
map.addPolygon('black', '#0000FF', points, 99999); //Cria o setor
0
Author: Luis Faconi, 2019-03-25 16:20:51