0

緯度と経度を に変更する必要がありISN93ます。

ISN93 形式の GIS データで遊んでいるので、同じ形式の GPS を取得する必要があります。

これらの変換を実行できるコードはありますか?

4

2 に答える 2

2

ISN93私は数年前にこの Java コードを作成しました。これは The system used by GPS:に変換されますWGS84

https://github.com/Kjarni/StraetoRouteAPI/blob/master/java/ISN93_to_WGS84.java

package org.kjarni;

import android.graphics.PointF;

/*
 * Copyright (c) 2012, Gunnar Gu�var�arson, Gabr�el A. P�tursson
 * All rights reserved.
 * 
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *     * Redistributions of source code must retain the above copyright
 *       notice, this list of conditions and the following disclaimer.
 *     * Redistributions in binary form must reproduce the above copyright
 *       notice, this list of conditions and the following disclaimer in the
 *       documentation and/or other materials provided with the distribution.
 *     * Neither the name of the <organization> nor the
 *       names of its contributors may be used to endorse or promote products
 *       derived from this software without specific prior written permission.
 * 
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */

/*
 * // example conversion:
 * PointF point = new PointF(359583, 406481);
 * ISN93_to_WGS84 converter = new ISN93_to_WGS84();
 * PointF result = converter.ISN93_WGS84(point);
 * label1.setText("x: " + result.x + " y: " + result.y);
 */

public class ISN93_to_WGS84
{
    private double a     = 6378137.0;
    private double f     = 1.0 / 298.257222101;
    private double lat1  = 64.25;
    private double lat2  = 65.75;
    private double latc  = 65.00;
    private double lonc  = 19.00;
    private double eps   = 0.00000000001;
    private double lat   = 0;
    private double delta = 1.0;

    private double rho, e, dum, sint, f2sin1, pol1, polc, peq;

    public ISN93_to_WGS84()
    {
        rho    = 45.0 / Math.atan2(1.0, 1.0);
        e      = Math.sqrt(f * (2 - f));
        dum    = f2(Math.sin(lat1 / rho)) - f2(Math.sin(lat2 / rho));
        sint   = 2 * (Math.log(fx(lat1)) - Math.log(fx(lat2))) / dum;
        f2sin1 = f2(Math.sin(lat1 / rho));
        pol1   = fx(lat1) / sint;
        polc   = f3(latc) + 500000.0;
        peq    = a * Math.cos(latc / rho) / (sint * Math.exp(sint * Math.log((45 - latc / 2) / rho)));
    }

    private double fx (double p)
    {
        return a * Math.cos(p / rho) / Math.sqrt(1 - Math.pow(e * Math.sin(p / rho), 2));
    }

    private double f1 (double p)
    {
        return Math.log((1 - p) / (1 + p));
    }

    private double f2 (double p)
    {
        return f1(p) - e * f1(e * p);
    }

    private double f3 (double p)
    {
        return pol1 * Math.exp((f2(Math.sin(p / rho)) - f2sin1) * sint / 2);
    }

    public PointF ISN93_WGS84(PointF input)
    {
        double pol  = Math.sqrt(Math.pow(input.x - 500000, 2) + Math.pow(polc - input.y, 2));
        double lon  = 90 - 2 * rho * Math.atan(Math.exp(Math.log(pol / peq) / sint));
        double fact = rho * Math.cos(lon / rho) / sint / pol;

        while (Math.abs(delta) > eps)
        {
            delta = (f3(lon) - pol) * fact;
            lon += delta;
        }

        lat = -(lonc + rho * Math.atan((500000 - input.x) / (polc - input.y)) / sint);
        return new PointF((float)lat, (float)lon);
    }
}
于 2015-04-05T09:35:50.207 に答える
1

WGS84 を ISN93 に変換する JavaScript は次のとおりです。

https://gist.github.com/kristjanmik/6925cbefaa311145c58a

function WGS84_To_ISN93(l,m){
    l = parseFloat(l);
    m = parseFloat(m);
    var k=l*0.0174532925199433;
    var p=0.0818191913305*Math.sin(k);

    var o=11616778.382033*Math.pow(Math.tan(
        0.785398163397448-(k/2))/Math.pow(
        (1-p)/(1+p),0.04090959566525),0.90633380084752);

    var q=(m+19)*0.0158185089469038;
    return {
        x:Math.round((500000+o*Math.sin(q))*1000)/1000,
        y:Math.round((3482044.27322585-o*Math.cos(q))*1000)/1000
    };
}

使用する前に、これに関する一連のテストを必ず実行してください。すべての場合において正確であることを確認するために、これを完全に分析したわけではありません。何か問題がありましたらお知らせください。

于 2015-04-05T15:43:04.963 に答える