Clear Filters
Clear Filters

Latitude Longtitude Altitude convert to X Y Z with starting reference

131 views (last 30 days)
I have a gpx data logged by mobile smartphone. So I have latitude longitude and gps altitude (meters)
I am not a geo expert. I am trying to obtain a simple 3D digitized road from this data.
The data should be in x y z format.
I tried a code like this
p = lla2ecef(data1,'WGS84');
but the Z answer is actually really different from the altitude data. Same for x and y data.
plot3D result of this code is representing the profile but the values are really huge. It seems I should substract from a reference ??? That I do not know.
So is there any method or way that to convert is to real x y and z that helps to create 3D road with (x,y,z,) coordinate
Or to convert it to a data format that the starting point is 0 0 0 and.. or 0 0 6.5 it will change with road...(6.5 is starting height)
(ın other words ı am mentioning changing the lat long alttiude data to 3D line that starting reference can be changed by me)
GPS data is attached in mat format to the question.
Michael Madelaire
Michael Madelaire on 30 Dec 2018
Edited: Michael Madelaire on 30 Dec 2018
So let me understand what you are saying.
The data you have given is [latitude, longitude, altitude]. I presume that the altitude is from sea-level? since the values are so small.
Next I do not understand why you suddenly say that the data is in x, y, z? wasn't it just in geodetic...
Doesn't take x, y, z as input or give them as output. Simply changes reference frame.
But what you simply want is to illustrate the path in a plot, yes?
Orkun OZENER on 31 Dec 2018
Edited: Orkun OZENER on 31 Dec 2018
Dear Michael Thanks for your answer,
Actually when I check the meaning of ECEF than I actually undestand it gives me the exact coordinates regarding to earth center at three axis.
On the other hand for digitising the road , let assume I need the coordinates of the centerline of the road. Assume that the starting point of this centerline is 0 0 0 in space and I know its lat long alt from gps. In other words the starting point should not be earth center. ( like creating a 3D line with starting point is 0 0 0)
center line lat long alt (known from gps)
0 0 0 ..., ..., ...
? ? ? ..., ..., ...
? ? ? ..., ...., ...
En example x y z
-0.000 0.000 -0.000
-1.000 0.000 -0.016
-2.000 0.000 -0.032
-3.000 0.000 -0.047
-4.000 0.000 -0.063
-5.000 0.000 -0.079
-6.000 0.000 -0.094
-7.000 0.000 -0.108
-8.000 0.000 -0.123
-9.000 0.000 -0.137
-10.000 0.000 -0.152
-11.000 0.000 -0.167
-12.000 0.000 -0.181
-13.000 0.000 -0.196
-14.000 0.000 -0.211
-15.000 0.000 -0.225
-16.000 0.000 -0.239
I am really mixed . But I assume I need new calculations.

Sign in to comment.

Answers (1)

Michael Madelaire
Michael Madelaire on 2 Jan 2019
Hi, there are still an unanswered question about the altitude that you have applied. Is it altitude above sea level? or is it some other reference point?
1) Convert your GPS coordinates from long, lat and altitude to long, lat, radius (from Earths center).
2) Use a function like XCFRAME to convert from long, lat, raidus to XYZ.
3) Substract the first position (t=0) from all others, thus making it the new reference point.
  1 Comment
Orkun OZENER on 3 Jan 2019
Thanks for your answer. Yes, the altitude is above sea level. I will look to the function will be be back to you. Thanks

Sign in to comment.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!