Borrar filtros
Borrar filtros

Conversion from geodetic coordinates to UTM Coordinates

16 visualizaciones (últimos 30 días)
Rafay Ali
Rafay Ali el 23 de Abr. de 2019
Hello,
I have a data set coming form a GPS sensor which is giving me the value in geodetic coordinates (lat, long, alt) and I want to convert it into UTM coordinates. I am trying two approaches and apparently, the answer is varying and with a large difference. Now, I can't validate which answer is correct. Could anyone please help me.
First approach,
My first approach is using the formula and running it for all the values of latitude and longitude that I have. The latitude and longitude are in degrees and the altitude is in meters. So the code is transforming the formula and is giving me the values. The code is attached.
Second Approach
I found out the command [X,Y] = ll2utm (lat,long) and I am using this. This has lat and long in degrees only and is returning me x and y in meters.
%% Hitch through Triangularization
trucklat = degtorad(lat);
trucklon = degtorad(long);
trailat = degtorad(lat1);
trailon = degtorad(long1);
% WGS84 ellipsoid constants:
a = 6378137;
e = 8.1819190842622e-2;
% intermediate calculation
% (prime vertical radius of curvature)
Ntrail = a ./ sqrt(1 - e^2 .* sin(trailat).^2);
Ntruck = a ./ sqrt(1 - e^2 .* sin(trucklat).^2);
% results:
truck.x = (Ntruck+alt) .* cos(trucklat) .* cos(trucklon);
truck.y = (Ntruck+alt) .* cos(trucklat) .* sin(trucklon);
truck.z = ((1-e^2) .* Ntruck + alt) .* sin(trucklat);
trailer.x = (Ntrail+alt1) .* cos(trailat) .* cos(trailon);
trailer.y = (Ntrail+alt1) .* cos(trailat) .* sin(trailon);
trailer.z = ((1-e^2) .* Ntrail + alt1) .* sin(trailat);

Respuestas (0)

Categorías

Más información sobre Coordinate Systems en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by