JavadocMD / simplelatlng

A simple, lightweight library for common latitude and longitude calculation needs in Java.
90 stars 20 forks source link

Calculate points given a distance and direction from another point #3

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Given a point A, find the point B that is a distance C and a direction D from 
A. 

Original issue reported on code.google.com by awmr...@gmail.com on 12 Mar 2011 at 6:56

GoogleCodeExporter commented 9 years ago
Sounds like a reasonable request. How would you prefer to provide direction? 
The simplest way would be azimuth related to True North, though I could also 
support Magnetic North if desired.

Original comment by TylerCo...@gmail.com on 15 Mar 2011 at 12:37

GoogleCodeExporter commented 9 years ago
No idea. I was looking for points in the four compass directions (north, south, 
east, west). Pretty simple requirement (I was calculating a bounding box 
actually). The most obvious would be radians from True North?

btw I ended up just using some code I found on the net to do this. I'm guessing 
it was simpler because I didn't need arbitrary direction. 

Actually, that would probably be more simple / useful. Add something like

Point addLongitude(Point A, distance C); // Returns the point C metres to the 
east of A. Specify negative distance to get points west.

Point addLatitude(Point A, distance C); // Returns the point C metres to the 
north of A. Specify negative distance to get points south.

Another idea. Maybe you could add a getBoundingBox(Point A, sideLength B) 
function??

Just some ideas. My code works now (I think). If I had something unit tested 
for corner cases and optimised I might use it instead.

Thanks

Original comment by awmr...@gmail.com on 15 Mar 2011 at 1:04

GoogleCodeExporter commented 9 years ago
Have you checked out the RectangularWindow included with this library? Would 
that fit your needs? I would be open to providing alternative methods for 
constructing such windows if that would be helpful.

Original comment by TylerCo...@gmail.com on 15 Mar 2011 at 1:29

GoogleCodeExporter commented 9 years ago
Damn straight. I think I remember looking at that but I guess it didn't seem 
obvious what it did. 

Would have saved me some time....

If I end up trying to use it I'll give you some feedback here.

Original comment by awmr...@gmail.com on 15 Mar 2011 at 2:30

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
that's what you're looking for?

http://www.movable-type.co.uk/scripts/latlong-vincenty-direct.html

Original comment by Mosh...@gmail.com on 24 May 2011 at 3:00

GoogleCodeExporter commented 9 years ago
Hello Folks,

Thanks for your work on simplelatlng ! I'm using it on my sunshine research 
project www.heliorama.com.

I needed this item years ago, so I wrote it. Check the java class in attachment.
It's not very exiting, but it do the trick for my purpose. 
The formula is from http://www.movable-type.co.uk/scripts/latlong.html.

Hope it helps !

Regards,

-Leo

PS: I also wrote a "LatLngPloter" that implements Iterable<LatLng>. 
Same idea : inputs are one latlng, bearing and distance, result is 
Iterable<LatLng>.

Original comment by leo.flan...@heliorama.fr on 11 Apr 2013 at 12:34

Attachments:

GoogleCodeExporter commented 9 years ago
This has been implemented as of v1.2.0. See LatLngTool.travel() for details.

Original comment by TylerCo...@gmail.com on 13 May 2013 at 1:28