Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: st: RE: reverse vincenty
From
Scott Merryman <[email protected]>
To
[email protected]
Subject
Re: st: RE: reverse vincenty
Date
Wed, 6 Oct 2010 07:42:49 -0500
Try this:
//vincenty 41.75499 -124.194 ? -124.194, hav(5)
local lon1 = -124.194
local lat1 = 41.75499
local d = 5
local R = 3956.5438
local maxlon =`lon1' + (180/_pi)*asin(sin((`d'/`R')) / cos(_pi/180*`lat1'))
local maxlat = `lat1' + (180/_pi)*(`d'/`R')
local minlon =`lon1' - (180/_pi)*asin(sin((`d'/`R')) / cos(_pi/180*`lat1'))
local minlat = `lat1' - (180/_pi)*(`d'/`R')
disp "Longitude (`maxlon' , `minlon')"
disp "Latitude (`maxlat' , `minlat')"
vincenty 41.75499 -124.194 41.75499 `maxlon'
return list
vincenty 41.75499 -124.194 `maxlat' -124.194
vincenty 41.75499 -124.194 41.75499 `minlon'
vincenty 41.75499 -124.194 `minlat' -124.194
Scott
On Wed, Oct 6, 2010 at 5:41 AM, Nick Cox <[email protected]> wrote:
> H Wright is presumably asking about commands, not functions. There is no inbuilt function in Stata (or Mata) for this calculation. A user-written Mata function should be perfectly doable.
>
> Also, -vincenty- is a user-written command from SSC (Austin Nichols).
>
> But I don't know of any such code.
>
> Nick
> [email protected]
>
> H Wright
>
> I have been using the vincenty function to calculate
> distances between latitudes and longitudes. I would now like to find
> points that are X miles from a given coordinate.
>
> Is anyone aware of a function that would calculate a latitude of a new point if all other inputs are know?
>
> For example :
>
> vincenty 41.75499 -124.194 ? -124.194, hav(5)
>
> So I want to know the latitude of the point 5 miles away on the same longitude?
>
> I looked at the code in the vincenty ado file and it is beyond my mathematical ability to calculate this number myself.
>
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/