本文介绍了如何将经度/纬度映射到变形的地图?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一堆纬度/经度对,它们映射到(地理失真的)地图上的已知x/y坐标.

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.

您不能假设North向上:您只拥有现有的lat/long-> x/y映射.

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

这不是墨卡托投影,也不是类似的东西.它的可读性被任意扭曲(想想地铁地图).我只想使用最接近的5到10映射,以使映射其他部分的失真不会影响我要计算的映射.

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.

推荐答案

关于失真的种类,是否还有其他更具体的细节?例如,如果使用Mercator投影将您的纬度和经度扭曲"到2D地图上,则转换数学为随时可用.

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.

如果地图确实被任意扭曲,您可以尝试很多方法,但是最简单的方法可能是计算加权平均值.您的权重可以是从新点到每个现有点的x/y距离的平方的倒数.

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.

一些伪代码:

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.

这篇关于如何将经度/纬度映射到变形的地图?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-06 06:44