# locating latitude-longitude point in a piste-map with matrix transforms

I am trying to plot points of a particular latitude longitude on this image of a Swiss mountainous landscape. What I am doing is I have some 54 known location-points plotted on this image (not visible in the linked image), which is a piste map, and is therefore an artist's impression of the landscape. I found out the latitude-longitudes and also height above sea level for these 54 known points. I opened my piste map in the GIMP, and plotted the 54 points, while at the same time reading their co-ordinates in points, in the piste-map. So, I have x-y coordinates (lat-long) and z coordinate (height above sea level) for all those 54 points (so its a 3d co-ordinate system that I have), and I also have X-Y coordinates of those places in my piste-map (a 2d co-ordinate system), and I assume a Z=1 for all those points.

To locate a particular lat-long on my piste-map(I have the coordinates for this place, i.e. the lat-long but not elevation), I need to calculate their X-Y on the piste-map. My approach is, that I calculate distances between this point which is to be located and those 54 known points , and then I sort them in ascending order. The first two points in this order will be the nearest points to the one which we want to locate. Now, I find my 3rd known point, and for that, I loop over the rest of the points, to get the nearest possible point such that this point forms a triangle with the first two closest points with the point which is to be located falling inside the formed triangle. Now, I have three known points forming a triangle say triangle ABC. For these known points, I have a triangle A'B'C' in the piste map, and the point to be located lies in the latter. I figure out the transform matrix which when multiplied with the 3X3 matrix of the three known points(in this 3X3 matrix, each row corresponds to a point, with the column values x,y and z in the 3d scape) results in a 3X3 matrix of those points in the piste-map. I multiply this transform matrix calculated with a new 3X3 matrix for three points, the first one being the point to be located, and the remaining two are the last two known points in the first 3X3 matrix. This way, the first two elements of my resulting matrix are the X and Y values for the point to be located, and I proceed ahead to draw the point on the piste-map. Is this approach correct with respect to the way I am using the transform matrix? Thanks! I would really appreciate if any alternative approaches are suggested as well!

If the image is in the least realistic--and it appears to be--then it represents a projection from a portion of Euclidean three-space onto a portion of two-space. We cannot expect this projection to have a nice mathematical formula, because it is likely the artist has introduced irrregular small distortions, but we can expect its formula to somewhat approximate formulas for such projections. These formulas tend to be linear or projective and they also tend to be simpler when Cartesian coordinates are used.

Therefore, what you should consider doing at the outset is this:

1. Convert all (lat, lon, elevation) values to geocentric (x, y, z) values.

2. Associated with each (x, y, z) value is a pair of image coordinates (u, v). We probably lose little by estimating u and v independently of each other, which reduces the problem to one of interpolating samples of a scalar function. The previous considerations suggest that you seek interpolating functions that locally are of the form

``````u = a x + b y + c z + d
``````

(linear) or even

``````u = (a x + b y + c z + d) / (a' x + b' y + c' z + 1)
``````

(projective) and similarly for v. This reduces the problem to one of performing an interpolation in three dimensions, which is sufficiently routine to give you access to a large body of methods and software.

Alternatively, you might consider triangulating the (x,y,z) points and interpolating their associated (u,v) values separately across the triangles; even a linear interpolation across each triangular face could do a pretty good job. This is a 3D analog of what ESRI's 3D Analyst does in two dimensions with TINs.

Please note, though, that unless you have the elevation of a given location, you cannot hope to plot it accurately on this map: changing the elevation will create a nearly vertical line on the map, whence your location could be plotted practically anywhere along this line. With considerable work you could solve this problem for points on the ground by first digitizing the evident discontinuities in the inverse projection--that is, representing the outlines of mountain ridges as polylines--and constructing a local inverse interpolator (respecting these breaklines) that associates to each (u,v) on the image a location (x,y,z) in the world. You could exploit this to identify which point along any vertical line has a (lat,lon) close to the one you started with.

• thanks a lot Whuber! That is some useful info! could I forget z altogether, and use something like u = a x + b y + d and same for v? – Sonu Jha Mar 4 '13 at 15:54
• No; one key point here is that z (elevation) is essential for locating image coordinates (u,v). After all, the image is designed so that elevation roughly corresponds to height in the drawing; if you ignore elevation altogether, you will have to scan up and down the drawing and make a guess concerning where the point really should lie. – whuber Mar 4 '13 at 16:17
• I came across this magazin.unic.com/en/2012/02/16/… they seem to have totally dispensed with the elevation data. – Sonu Jha Mar 4 '13 at 22:56
• In their case, there is a one-to-one correspondence between points on the map (at least most points of interest) and locations on the earth. In your example there is not: your image has many hidden surfaces removed. If you want to restrict to the visible surfaces, you need to pay attention to my last paragraph, which describes how you can go about doing that. Please notice, too, that this approach is restricted to depicting points on the ground rather than general points. When you're willing to make all these compromises, a "warping" solution--piecewise linear interpolation--will work. – whuber Mar 4 '13 at 23:05
• thanks a lot! I apologize for being a noob with GIS, so would yu please tell me how to derive x,y,z geocentric coordinates from latitude-longitude? – Sonu Jha Mar 6 '13 at 18:14