newbie question - proper lat/lon spec?

Topics: Algorithms
Aug 14, 2007 at 3:28 PM
This is a very newbie type question - What data is needed to properly and fully specify a point by latitude and longitude? The data that have been given does not "feel" complete in that I have only been provided a lat and lon in decimal degrees. I am pretty sure that I need to know the datum at the very least. If lat/long/datum specifies a point, is there a method that I can use to convert or transform the various datum-points to a single standard (the one that my map is set to)?

If my question is out of scope for this forum, please let me know and I will try elsewhere (pointers would be greatly appreciated).

Bill
Coordinator
Aug 16, 2007 at 11:51 PM
Edited Aug 20, 2007 at 5:16 PM
Hi Bill,

This is the right forum for this question.

In general, you do need to know the model of the earth that the lat / long comes from. The reason for this is that, by convention, when you talk about lat and long, you are actually talking about geodetic (or geographic) lat and long. (There are others, the most popular being geocentric and astronomical.) Also, the chances are that when you get a lat / long coordinate, you are using an underlying model of the earth which is ellipsoidal. This is an ellipse which is rotated it on an axis, forming a solid. In the case of the earth, it is the semi-minor axis of the ellipse which is rotated - the earth is fatter around the equator than it is around the poles.

These assumptions are reasonable (although they could be wrong), since these are the conventional assumptions when the terms latitude and longitude are used. They have an impact on where the point actually is on the earth. If we could assume that the earth was a perfect sphere (which a spherical datum does), then the datum isn't needed, since geodetic and geocentric latitude and longitude are the same on a sphere: you can figure out where a point is on the surface of the earth by an angle from the equatorial plane and which ever meridian of longitude you are using. On an ellipsoid, this breaks down, since the perpendicular, or normal, line to the surface of the ellipsoid which defines geodetic latitude doesn't necessarily go through the center, as geocentric latitude does. (The line does extend through the equatorial plane, however, and the angle that results in this intersection is the measure of the latitude.)

So, that means you need to know the shape of that ellipsoid in order to know where, exactly, the latitude and longitude are in other coordinate systems, as you guessed. This is all provided, however, that these assumptions we've been making hold up.

The problem you suggest, then, is how do you map one geodetic coordinate system to another? SharpMap supports this transformation. Actually, Proj.Net, a sibling project here at CodePlex, currently does this. The way it works, in general, is to convert a geodetic (both SharpMap as well as Proj.Net currently use the older and somewhat inaccurate term "geographic") coordinate system to a geocentric coordinate system, change the shape of the ellipsoid, and change back to a geodetic coordinate system. This ultimately amounts to a concatenated matrix which represent affine transform matrixes. When you concatenate matrixes, they can be represented by one matrix. An affine transform translates, scales and rotates to linearly map one point to another point - or one coordinate system to another coordinate system. All you need to know are the parameters which define each coordinate system, and you can generate this affine transform. SharpMap (via Proj.Net) parameterizes all of these coordinate system values, so all you need to do is to find the parameters for the coordinate system that your lat / long points are in, and the parameters of the coordinate system that your map is in, and you can set up the transform and apply it to the point. These parameters can be found by knowing the spatial reference system which the points are defined in.

The wiki page Apply on the fly transformation to a layer will help understanding the code you need to implement this transformation.

I know some of this might be unfamiliar, but go ahead and ask questions if you'd like and I'll break it down and perhaps I can help you gain a better understanding.
Aug 20, 2007 at 1:48 PM
Sorry for the delay in response - I was out showing the Sharpmap enhanced interface to a client to rave reviews. Thanks to all of the SharpMap developers for creating such a great tool and to the community for the support to make it happen.

Fantastic primer on the subject! I was hoping that you would tell me that everything was fine... :) Unfortunately, my niggling feeling was right and there is more work to be done. The good part is that it looks like SharpMap will make it painless. I'll pop back to this thread if I run into issues.

Thanks again,

Bill