Hi,
I have a database of coordinates (lat, lon) and I would like to randomly generate a set of new coordinates on a circle around the initial coordinates (and not within a circle). For each point (lat,lon) I want to generate 20 points (lat1;lon1), ... (lat20;lon20), etc. I have already succeeded in generating coordinates within a circle around the centroids, but those are at a distance that varies. I would like all the new coordinates to be at a given distance from the initial point.
Here is the code I use :
use coordinates.dta
forvalues i = 1/20 {
local phi = 2*runiform()*_pi
local r = 0.1
gen lon`i' = `r'* cos(`phi') + lon
gen lat`i' = `r'* sin(`phi') + lat
}
Any help or tips would be much appreciated!
Related Posts with Generate random points from a given point coordinates
Instrument set from initial period regressionHi I am running af 2sls model with panel data where I on average have 6 observation for each indivi…
Cluster by firmHi- does clustering by firm has any impact on coefficient (or on Constant)? I read it reduces coeffi…
Gravity model estimation using PPML with fixed effectsHello All, I'm trying to estimate GVC trade flows in a gravity model, using the PPML method. My dep…
Negative -hausman- in the logit/xtlogit decisionI have unbalanced panel data and want to decide whether to compute (pooled) -logit-, -xtlogit,fe- or…
Estimation of the same survival models converges sometimes and sometimes doesn'tI estimate survival models. However, the model converges sometimes and sometimes it doesn't even tho…
Subscribe to:
Post Comments (Atom)
0 Response to Generate random points from a given point coordinates
Post a Comment