开发者

Draw a circle to the map using an array of GPS coords

I would like to be a开发者_如何学Goble to draw or at least calculate an area of a map using a series of GPS coordinates, my php code currently limits the coords to an area around the GPS's current position.

My question therefore is: How would I calculate an area (e.g. a circle) from an array of GPS coords? (they are in decimal format).


You can calculate the centroid of the polygon formed by the series of Coordinates that you have - this method works well only if it is not near the poles of the variant between the coordinates is not more than 100 miles or so. Your tolerances for errors might be greater or less though than what this method offers. Eg. the centre of a polygon with points (x1..5,y1..5) is:

Centroid X coord = (Sum (x1+..x5) / 5 Centroid Y coord = (sum(y1+..y5) / 5

Now check the farthest point from this Centroid - that will be the radius of your circle...

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜