简体   繁体   中英

Get compass orientation of wgs84 coordinates or polygon

I got a set of wgs84 coordinates to place a polygon on Google Maps. I am wondering if i can use the same coordinates to get a compass direction of the coordinates. I don't need a solution specific for Google Maps, javascript or php. I am just wondering what the right approche would be.

这样的事情将是最终的结果。我知道它在后台需要某种算法 Something like this would be the end result. I understand it needs some sort of algorithm in the background

I found Geolib and the 'getCompassDirection' function but this function only allows 2 points to create a line and get the bearing(angle) of that line.

You can't get any direction information out of a single position coordinate.

Position coordinates don't represent any knowledge about the orientation of an object. Therefore you need something that has direction (ie a vector between two coordinates) to calculate compass direction. That's exactly why the function you mentioned asks for two points.

This means you can get a compass direction for any edge of a polygon (by using its two end points), but not for its vertices.

Hope this helps!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM