简体   繁体   中英

Adding metresc distance to Long/Lat e6

Sorry if this has been asked before. I've looked at posts about Haversine and ellipsoids.

I have two points in 1e6 google maps geopoint format that define a directed vector.

I need to create an OABB (object-aligned bounding box) for the directed vector. Easily done by calculating the normals (-y,x), (y,-x). The only issue is that the length of the normalized vectors defines the width of the OABB.

Say for instance, I want these normals to be 20 km long... So I need to scale the normals by 20km, but I have no idea how to do this in the 1e6 format that the Geopoint class uses.

If someone could post some code on how to add metre values to geopoints, I would love them.

Cheers. Craig.

Found the answer here -> https://gis.stackexchange.com/questions/2951/algorithm-for-offsetting-a-latitude-longitude-by-some-amount-of-meters

Not before I worked out the damned thing myself though by using the radius of the earth and some simple trig. While I am a competent enough mathematician to do this, I shouldn't have to.

(rant) What are Google playing at? It's obvious that GMap developers are going to need to do vector arithmetic on Geopoint and Location, they should have built-in vector operators. (/rant)

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