How To Map A Latitude/longitude To A Distorted Map?

- 1 answer

I have a bunch of latitude/longitude pairs that map to known x/y coordinates on a (geographically distorted) map.

Then I have one more latitude/longitude pair. I want to plot it on the map as best is possible. How do I go about doing this?

At first I decided to create a system of linear equations for the three nearest lat/long points and compute a transformation from these, but this doesn't work well at all. Since that's a linear system, I can't use more nearby points either.

You can't assume North is up: all you have is the existing lat/long->x/y mappings.

EDIT: it's not a Mercator projection, or anything like that. It's arbitrarily distorted for readability (think subway map). I want to use only the nearest 5 to 10 mappings so that distortion on other parts of the map doesn't affect the mapping I'm trying to compute.

Further, the entire map is in a very small geographical area so there's no need to worry about the globe--flat-earth assumptions are good enough.



Are there any more specific details on the kind of distortion? If, for example, your latitudes and longitudes are "distorted" onto your 2D map using a Mercator projection, the conversion math is readily available.

If the map is distorted truly arbitrarily, there are lots of things you could try, but the simplest would probably be to compute a weighted average from your existing point mappings. Your weights could be the squared inverse of the x/y distance from your new point to each of your existing points.

Some pseudocode:

estimate-latitude-longitude (x, y)

    numerator-latitude := 0
    numerator-longitude := 0
    denominator := 0

    for each point,
        deltaX := x - point.x
        deltaY := y - point.y
        distSq := deltaX * deltaX + deltaY * deltaY
        weight := 1 / distSq

        numerator-latitude += weight * point.latitude
        numerator-longitude += weight * point.longitude
        denominator += weight

    return (numerator-latitude / denominator, numerator-longitude / denominator)

This code will give a relatively simple approximation. If you can be more precise about the way the projection distorts the geographical coordinates, you can probably do much better.