1

私は現在「トリップトラッカー」に取り組んでいます。目標は、MapQuest (または OpenStreetMap) からダウンロードした静止画像マップに GPS 座標 (GPS デバイスによって記録されたもの) を配置することです。この目標を達成するために、次の手順に従いました。

  1. GPS 座標セットの中心を見つける ((maxLat-minLat)/2, (maxLon-minLon)/2)
  2. MapQuest から「座標セットの中心」を中心とした 3840x3840 マップ (今のところ固定ズーム 15) をダウンロードします。
  3. メルカトル図法を使用して (私は EPSG:4326 または EPSG:3857 で球形と楕円形の両方を試します)、中心の (X,Y) をメートル単位で取得します
  4. 私のセットの各ポイントについて
  5. メルカトル図法を使用してポイントの (X,Y) を取得します
  6. point(X,Y) を center(X,y) に引きます
  7. ズーム レベルとマップ (タイル?) 幅に従ってメートルをピクセルに変換します (タイル幅 (256) とマップ幅 (3840) の両方を試しました)

残念ながら、1 週間の調査と試行で、私はそれらのポイントを設定することに成功しませんでした。

この種の問題に対する完全な解決策を持っている人はいますか?

ありがとうございました

編集#1

(削除: 矛盾)

編集#2

ここにきれいなプロジェクトのサンプルがあります

https://dl.dropboxusercontent.com/u/429726/MapSample.zip

  • パスは 90° 回転します (だまされた @MainWindow.xaml.cs:L130)
  • パスは平坦です

画像: https://dl.dropboxusercontent.com/u/429726/MapSample.jpg

編集 #3

複数の数式を追加

GeographicCoordinates > ToMercator() の変更

public System.Windows.Point ToMercator(int test = 0)
{
    System.Windows.Point mercator;
    double x = this.Longitude.ToMercator(test);
    double y = this.Latitude.ToMercator(test);
    mercator = new System.Windows.Point(x, y);
    return mercator;
}

GeographicCoordinate > ToMercator() の変更

public double ToMercator(int test = 0)
{
    double result = 0;
    switch (this.Type)
    {
        case(GeographicCoordinateType.Longitude):
            switch (test) { 
                case 0:
                    return this.DecimalDegrees.ToRadians() * Maps.EarthGreatRadius;
                case 1:
                    //http://jackofalltradesdeveloper.blogspot.be/2012/03/how-to-project-point-from-geography-to.html
                    return this.DecimalDegrees * 0.017453292519943 * 6378137;
                case 2:
                    //http://alastaira.wordpress.com/2011/01/23/the-google-maps-bing-maps-spherical-mercator-projection/
                    return this.DecimalDegrees * 20037508.34 / 180;
            }
            break;
        case(GeographicCoordinateType.Latitude):
            switch (test)
            {
                case 0:
                    double latitude = this.DecimalDegrees;
                    if (latitude > 89.5)
                    {
                        latitude = 89.5;
                    }
                    if (latitude < -89.5)
                    {
                        latitude = -89.5;
                    }
                    double temp = Maps.EarthGreatRadius / Maps.EarthGreatRadius;
                    double es = 1.0 - (temp * temp);
                    double eccent = Math.Sqrt(es);
                    double phi = latitude.ToRadians();
                    double sinphi = Math.Sin(phi);
                    double con = eccent * sinphi;
                    double com = 0.5 * eccent;
                    con = Math.Pow((1.0 - con) / (1.0 + con), com);
                    double ts = Math.Tan(0.5 * ((Math.PI * 0.5) - phi)) / con;
                    double y = 0 - Maps.EarthGreatRadius * Math.Log(ts);
                    return y;
                case 1:
                    double FSin = Math.Sin(this.DecimalDegrees.ToRadians());
                    return 6378137 / 2.0 * Math.Log((1.0 + FSin) / (1.0 - FSin));
                case 2:
                    y  = Math.Log(Math.Tan((90 + this.DecimalDegrees) * Math.PI / 360)) / (Math.PI / 180);
                    return y * 20037508.34 / 180;
            }
            break;
        default:
            throw new Exception();
    }
    return result;
}

編集#4

複数の数式と Proj.Net ライブラリを試してみましたが、常に同じ形状 (-90° && "flatened") になります。

4

3 に答える 3

0

私は過去にこれを使用して、Windows フォーム クライアントのマップに情報を作成しました。

http://greatmaps.codeplex.com/

于 2014-10-15T15:16:09.133 に答える
0

これが答えです

GeographicCoordinates > ToMercator()

public System.Windows.Point ToMercator(int test = 0)
{
    System.Windows.Point mercator;
    double x = this.Longitude.ToMercator(test);
    double y = this.Latitude.ToMercator(test);
    mercator = new System.Windows.Point(x, y);
    return mercator;
}

する必要があります

public System.Windows.Point ToMercator(int test = 0)
{
    System.Windows.Point mercator;
    double x = this.Latitude.ToMercator(test);
    double y = this.Longitude.ToMercator(test);
    mercator = new System.Windows.Point(x, y);
    return mercator;
}

GeographicCoordinate > ToMercator() は GeographicCoordinateType.Latitude/Longitude のケースを入れ替える必要があります。

また、半球に合わせて Y を修正する必要がありました

&仕事が終わりました。

于 2014-10-17T13:27:32.247 に答える
0

マップ座標もメルカトルに変換する必要があります。マップのデルタ x とデルタ y と画像プロパティが必要です:緯度/経度をピクセル座標に変換しますか? .

于 2014-10-15T15:08:48.210 に答える