|
Posted by wilson on July 27, 2005, 10:37 am
Please log in for more thread options
Hi,
this must be a very basic message. If it's been answered, sorry, is
there a FAQ that I should consult? I'm new to the group. Anyway, I'm
looking for a Matlab routine that converts lat and long to UTM.
Something simple is fine - I just want to get an idea of the path of a
set of lat long points, the points originate from a GPS receiver
attached to a car. I'm looking at 100 points (10 seconds) of data at a
time, so distances are very short.
Thanks!
|
|
Posted by jimirwin on July 28, 2005, 1:24 pm
Please log in for more thread options
wilson@volpe.dot.gov wrote in news:1122485856.019220.34170
@g43g2000cwa.googlegroups.com:
> I'm
> looking for a Matlab routine that converts lat and long to UTM.
> Something simple is fine - I just want to get an idea of the path of a
> set of lat long points, the points originate from a GPS receiver
> attached to a car. I'm looking at 100 points (10 seconds) of data at a
> time, so distances are very short.
Do you really need UTM, or do you simply want to see the path relative to
the starting point? It's a lot simpler to plot the path relative to the
starting point than it is to calculate UTM coordinates. The actual
transverse mercator calculation isn't hard, but UTM requires you to deal
with the zones and the possibility that your path crossed a zone. The UTM
easting will have a discontinuity at zone crossings. A full UTM conversion
has to deal with some irregular zones and do a UPS projection for zones
A,B,Y, and Z.
--
Jim Irwin
http://www.holoscenes.com
|
|
Posted by wilson on July 28, 2005, 6:33 am
Please log in for more thread options Thanks for your reply - I only need the path relative to the starting
point. NSEW directions would be nice, but not essential.
|
|
Posted by jimirwin on July 29, 2005, 1:55 am
Please log in for more thread options wilson@volpe.dot.gov wrote in news:1122557584.836971.228480
@g44g2000cwa.googlegroups.com:
> Thanks for your reply - I only need the path relative to the starting
> point. NSEW directions would be nice, but not essential.
>
>
Try this snippet of MATLAB:
function xy = toXY(p0, p)
% toXY computes the [x y] coordinate of a point p
% relative to a point p0, where p and p0 are vectors
% [lon lat] in degrees, and xy = [x y] in meters.
a = 6378137.0; % meters
es = 6.694379990141320E-03;
d = (p - p0) * pi / 180.0;
m = (p(2) + p0(2)) * pi / 360.0;
t = 1 - es*sin(m)^2;
r = a * [cos(m)/sqrt(t), (1-es)/t^1.5];
xy = d .* r;
Example:
p0 = [0, 44]; % origin is lon=0, lat=44 degrees north
p = [0.016667, 44]; % point p is lon=1 minute east, lat=44 degrees north
toXY(p0,p)
Ans xy =
[1.3368e+3 meters east, 0 meters north of p0]
This will be accurate for separations up to about 50 or 100km, at latitudes
below about 85 degrees.
--
Jim Irwin
http://www.holoscenes.com
|
| Similar Threads | Posted | | Lat/Long conversion | April 24, 2004, 3:50 pm |
| Lat/Long Coordinates?? | March 8, 2005, 12:57 am |
| convert x,y to lat,long | February 28, 2007, 2:40 pm |
| Long Love? | September 15, 2007, 10:58 am |
| Lat&Long to x,y on a rectangular projection | December 23, 2005, 9:20 am |
| Distance Lat Long Caculations | August 3, 2006, 7:44 pm |
| How do I export Lat/Long in ArcView? | August 4, 2006, 12:17 pm |
| Transforming long/lat to a stereographic projection | December 17, 2004, 2:02 pm |
| (very long) FAQ Q5.1 Computing The Distance Between Two Points | April 13, 2005, 10:10 am |
| conversion of data (NAD83 to lat/long) | September 23, 2005, 1:31 pm |
|