-3

We have two position A and B with the specified characteristics on the map. We want to position out between these two points at a distance of 50 meters. enter image description here

Hamidreza
  • 1
  • 1
  • Does this answer your question? [How to take 5 km points in all directions of a location, geocoding google api?](https://stackoverflow.com/questions/7858905/how-to-take-5-km-points-in-all-directions-of-a-location-geocoding-google-api) – MrUpsidown Dec 07 '20 at 11:56

1 Answers1

0

You can use the geometry library for this: https://developers.google.com/maps/documentation/javascript/geometry https://developers.google.com/maps/documentation/javascript/reference/3/#spherical

From the docs:

Navigation Functions

When navigating on a sphere, a heading is the angle of a direction from a fixed reference point, usually true north. Within the Google Maps API, a heading is defined in degrees from true north, where headings are measured clockwise from true north (0 degrees). You may compute this heading between two locations with the computeHeading() method, passing it two from and to LatLng objects.

Given a particular heading, an origin location, and the distance to travel (in meters), you can calculate the destination coordinates using computeOffset().

In your case you might want to get the heading first

var heading = google.maps.geometry.spherical.computeHeading(latLngFrom, latLngTo)

then you can get the offset location:

google.maps.geometry.spherical.computeOffset(latlngFrom, distance, heading) 
Mervin Samy
  • 366
  • 4
  • 13