I thought I could import the latitude and longitude of these two ports in my do file and recover the lat and lon of all the observations solving two nonlinear equations (Euclidean distance equation).
I am aware of geo packages in stata that can recover lat and lon but since I do not have access to internet (strange, but it is what it is) while working with the data, I guess I need to actually solve a system of nonlinear equation.
These are the geo coordinates of the ports:
*reference coordinates
*-------------------------------------------------------------------------------
*Port of Bremen
Bt= 53.09722 // latitude
Bn= 8.75167 // longitude
* distance to port of Bremen is variable "dis4"
*Port of Hamburg
Ht=53.52472 // latitude
Hn=9.96333 // longitude
* distance to port of Hamburg is "dist6"
*--------------------------------------------------------------------------------
Euclidean distances:
lon= Bn + sqrt(dis4^2-(lat -Bt )^2)
lon= Hn + sqrt(dis6^2-(lat -Ht )^2)
this is a sample of the data:
Code:
* Example generated by -dataex-. For more info, type help dataex clear input long plz float(Dis4 Dis6) 81248 580258.25 604684.2 60315 331437.4 388282.9 24988 184782.4 137974.06 93185 514153.4 519856.5 93489 512082.1 516745.75 end
Plz is the id. Since I do not have experience with mata or other functions that solve a system of nonlinear equations in stata I could not manage to obtain what I need. Could you please offer any help?
0 Response to recovering latitude and longitude of the observations having distances to a specific points
Post a Comment