Google Maps V3 Circle & Circle that I created do not match

后端 未结 2 1559
情深已故
情深已故 2021-01-12 13:31

I created a circle using the Google Maps V3 API and also tried to make a circle of markers with the same radius.

Problem: The one I created is obli

2条回答
  •  清歌不尽
    2021-01-12 14:22

    One thing you need to remember here, the google circle is giving the distance between two points on a sphere (the earth) which is why your circle doesn't look the same.

    You did not specify what the purpose of the circle in your example is, but from the code snippet I can tell it has something to do with travel distances. In that case you might be interested to look into :

    The Haversine Formula

    or

    The Spherical Law of Cosines

    Also this page could provide you with some basis on how to tweak your formula to get the correct circle shape.

    Edit: For the sake of correctness, the earth is not a perfect sphere, but for all practical purposes it is assumed to be one.

提交回复
热议问题