2016-05-04 8 views
0

私は、ノースカロライナの州の飛行機の座標を緯度と経度に変換することが割り当てられています。「102719 = NAD 1983 StatePlane North Carolina FIPS 3200 Feet」をjMapProgLibの緯度と経度に変換する方法を教えてください。

EX:2_329_394.77272739、524_784.10055898は-77.8975142に変換し、35.1869162 参照:https://epsg.io/transform#s_srs=102719&t_srs=4326&x=2329394.7727274&y=524784.1005590

私はjMapProjLibから始まりました。しかし、正しい答えを得ていない。ここで

は、JUnitテストの形で私のコードです:

@Test 
public void testLCCProjection() { 
    System.out.println("getLCCProjection"); 

    // From \coordsys\esri file in project. Line 5703 
    //# NAD 1983 StatePlane North Carolina FIPS 3200 Feet 
    //<102719> +proj=lcc +lat_1=34.33333333333334 +lat_2=36.16666666666666 +lat_0=33.75 +lon_0=-79 +x_0=609601.2199999999 +y_0=0 +ellps=GRS80 +datum=NAD83 +to_meter=0.3048006096012192 no_defs <> 
    String[] args = new String[]{ 
     "+proj=lcc", // projection name is Lambert Conformal Conic 
     "+lat_1=34.33333333333334", // projectionLatitude 1 
     "+lat_2=36.16666666666666", // projectionLatitude 2 
     "+lat_0=33.75", // projectionLatitude 
     "+lon_0=-79", // projectionLongitude 
     "+x_0=609601.2199999999", // falseEasting in meters. This is the correct value. 
     // "+x_0=2000000.002616666", // falseEasting in feet 
     "+y_0=0", // falseNorthing 
     "+ellps=GRS80", // 
     "+datum=NAD83", // 
     "+to_meter=0.3048006096012192", // conversion to meters. 
    }; 

    // lccp stands for LamberConformalConicProjection 
    Projection lccp = ProjectionFactory.fromPROJ4Specification(args); 
    lccp.initialize(); 

    // input 
    double x = 2_329_394.77272739; // in feet 
    double y = 524_784.10055898; // in feet 
    // the correct answer see: https://epsg.io/transform#s_srs=102719&t_srs=4326&x=2329394.7727274&y=524784.1005590 
    double expectedLong = -77.8975142D; 
    double expectedLat = 35.1869162D; 

    // convert to meters 
    double toMeters = 0.3048006096012192; 
    double x_in_meters = x * toMeters; 
    double y_in_meters = y * toMeters; 
    Point2D.Double out = new Point2D.Double(); 
    Point2D.Double in = new Point2D.Double(); 
    in.x = x_in_meters; 
    in.y = y_in_meters; 

    // run the inverse transform. The magic happens here! 
    lccp.inverseTransform(in, out); 

    // verify the answer 
    double longitude = out.x; 
    double latitude = out.y; 
    System.out.println("lat/Long expected = " + expectedLat + " " + expectedLong); 
    System.out.println("lat/long in deg decimal = " + latitude + " " + longitude); 
    System.out.println("diff lat/long = " + Math.abs(expectedLat - latitude) + " " + Math.abs(
      expectedLong - longitude)); 
    assertEquals(expectedLong, longitude, 0.1); 
    assertEquals(expectedLat, latitude, 0.1); 

} 

これはグルジアのポイントを返します。それはノースカロライナにあるはずです。

修正方法?

ご協力いただければ幸いです!

この変換を処理するライブラリまたはパッケージがありますか? System.outに

出力:

lat/Long expected = 35.1869162 -77.8975142 
lat/long in deg decimal = 34.113370281502604 -83.26272018000135 
diff lat/long = 1.0735459184973948 5.365205980001349 
+1

System.outの出力は何ですか?なぜあなたは「メートルに変換する」ステップを持っていますか? [source SRSには+ units = us-ft'があります(http://epsg.io/102719.proj4)。また、 '+ x_0 = 609601.2199999999'はus-ftにあります。 –

+0

System.outの出力が質問テキストの最後に追加されます。 – fishjd

+0

値+ x_0 = 609601.2199999999(別名「False Easting」)はメートル単位です。フィートで表した+ x_0の値は+ x_0 = 2000000.002616666です。これはコードのコメントに追加されています。 – fishjd

答えて

0

を解決しました。上記は、xyのメートルへの変換が削除されたときに機能します。私はとても近かった。この提案のための 'Mike T'に感謝します。

ワーキングコード:はSystem.outに

public void testLCCProjection() { 
     System.out.println("getLCCProjection"); 

     // From \coordsys\esri file in project. Line 5703 
     //# NAD 1983 StatePlane North Carolina FIPS 3200 Feet 
     //<102719> +proj=lcc +lat_1=34.33333333333334 +lat_2=36.16666666666666 +lat_0=33.75 +lon_0=-79 +x_0=609601.2199999999 +y_0=0 +ellps=GRS80 +datum=NAD83 +to_meter=0.3048006096012192 no_defs <> 
     String[] args = new String[]{ 
      "+proj=lcc", // projection name is Lambert Conformal Conic 
      "+lat_1=34.33333333333334", // projectionLatitude 1 
      "+lat_2=36.16666666666666", // projectionLatitude 2 
      "+lat_0=33.75", // projectionLatitude 
      "+lon_0=-79", // projectionLongitude 
      "+x_0=609601.2199999999", // falseEasting in meters. This is the correct value. 
      // "+x_0=2000000.002616666", // falseEasting in feet 
      "+y_0=0", // falseNorthing 
      "+ellps=GRS80", // 
      "+datum=NAD83", // 
      "+to_meter=0.3048006096012192", // conversion to meters. 
     }; 

     // lccp stands for LamberConformalConicProjection 
     Projection lccp = ProjectionFactory.fromPROJ4Specification(args); 
     lccp.initialize(); 

     // input 
     double x = 2_329_394.77272739; // in feet 
     double y = 524_784.10055898; // in feet 
     // the correct answer see: https://epsg.io/transform#s_srs=102719&t_srs=4326&x=2329394.7727274&y=524784.1005590 
     double expectedLong = -77.8975142D; 
     double expectedLat = 35.1869162D; 
     // double toMeters = 0.3048006096012192; 

     Point2D.Double out = new Point2D.Double(); 
     Point2D.Double in = new Point2D.Double(); 
     in.x = x; 
     in.y = y; 

     // run the inverse transform. The magic happens here! 
     lccp.inverseTransform(in, out); 

     // verify the answer 
     double longitude = out.x; 
     double latitude = out.y; 
     System.out.println("lat/Long expected = " + expectedLat + " " + expectedLong); 
     System.out.println("lat/long in deg decimal = " + latitude + " " + longitude); 
     System.out.println("diff lat/long = " + Math.abs(expectedLat - latitude) + " " + Math.abs(
       expectedLong - longitude)); 
     assertEquals(expectedLong, longitude, 0.1); 
     assertEquals(expectedLat, latitude, 0.1); 

    } 

出力:

lat/Long expected = 35.1869162 -77.8975142 
lat/long in deg decimal = 35.18691619350664 -77.89751408312104 
diff lat/long = 6.493358739589894E-9 1.16878965172873E-7 

いや!

関連する問題