<legend id='lnBQl'><style id='lnBQl'><dir id='lnBQl'><q id='lnBQl'></q></dir></style></legend>
    • <bdo id='lnBQl'></bdo><ul id='lnBQl'></ul>
  • <i id='lnBQl'><tr id='lnBQl'><dt id='lnBQl'><q id='lnBQl'><span id='lnBQl'><b id='lnBQl'><form id='lnBQl'><ins id='lnBQl'></ins><ul id='lnBQl'></ul><sub id='lnBQl'></sub></form><legend id='lnBQl'></legend><bdo id='lnBQl'><pre id='lnBQl'><center id='lnBQl'></center></pre></bdo></b><th id='lnBQl'></th></span></q></dt></tr></i><div id='lnBQl'><tfoot id='lnBQl'></tfoot><dl id='lnBQl'><fieldset id='lnBQl'></fieldset></dl></div>
      <tfoot id='lnBQl'></tfoot>

      <small id='lnBQl'></small><noframes id='lnBQl'>

        Java,将纬度/经度转换为 UTM

        时间:2023-09-30

        <i id='PxIIl'><tr id='PxIIl'><dt id='PxIIl'><q id='PxIIl'><span id='PxIIl'><b id='PxIIl'><form id='PxIIl'><ins id='PxIIl'></ins><ul id='PxIIl'></ul><sub id='PxIIl'></sub></form><legend id='PxIIl'></legend><bdo id='PxIIl'><pre id='PxIIl'><center id='PxIIl'></center></pre></bdo></b><th id='PxIIl'></th></span></q></dt></tr></i><div id='PxIIl'><tfoot id='PxIIl'></tfoot><dl id='PxIIl'><fieldset id='PxIIl'></fieldset></dl></div>

      1. <legend id='PxIIl'><style id='PxIIl'><dir id='PxIIl'><q id='PxIIl'></q></dir></style></legend>

          <small id='PxIIl'></small><noframes id='PxIIl'>

          • <bdo id='PxIIl'></bdo><ul id='PxIIl'></ul>
              <tbody id='PxIIl'></tbody>
              1. <tfoot id='PxIIl'></tfoot>

                • 本文介绍了Java,将纬度/经度转换为 UTM的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  有没有人知道在 Java 中将地球表面位置从 lat、lon 转换为 UTM(比如在 WGS84 中)的方法?我目前正在研究 Geotools,但不幸的是解决方案并不明显.

                  Does anyone know of a way, in Java, to convert an earth surface position from lat, lon to UTM (say in WGS84)? I'm currently looking at Geotools but unfortunately the solution is not obvious.

                  推荐答案

                  我能够使用 Geotools 2.4 获得一些可行的东西,基于一些 示例代码.

                  I was able to use Geotools 2.4 to get something that works, based on some example code.

                  double utmZoneCenterLongitude = ...  // Center lon of zone, example: zone 10 = -123
                  int zoneNumber = ...                 // zone number, example: 10
                  double latitude, longitude = ...     // lat, lon in degrees
                  
                  MathTransformFactory mtFactory = ReferencingFactoryFinder.getMathTransformFactory(null);
                  ReferencingFactoryContainer factories = new ReferencingFactoryContainer(null);
                  
                  GeographicCRS geoCRS = org.geotools.referencing.crs.DefaultGeographicCRS.WGS84;
                  CartesianCS cartCS = org.geotools.referencing.cs.DefaultCartesianCS.GENERIC_2D;
                  
                  ParameterValueGroup parameters = mtFactory.getDefaultParameters("Transverse_Mercator");
                  parameters.parameter("central_meridian").setValue(utmZoneCenterLongitude);
                  parameters.parameter("latitude_of_origin").setValue(0.0);
                  parameters.parameter("scale_factor").setValue(0.9996);
                  parameters.parameter("false_easting").setValue(500000.0);
                  parameters.parameter("false_northing").setValue(0.0);
                  
                  Map properties = Collections.singletonMap("name", "WGS 84 / UTM Zone " + zoneNumber);
                  ProjectedCRS projCRS = factories.createProjectedCRS(properties, geoCRS, null, parameters, cartCS);
                  
                  MathTransform transform = CRS.findMathTransform(geoCRS, projCRS);
                  
                  double[] dest = new double[2];
                  transform.transform(new double[] {longitude, latitude}, 0, dest, 0, 1);
                  
                  int easting = (int)Math.round(dest[0]);
                  int northing = (int)Math.round(dest[1]);
                  

                  这篇关于Java,将纬度/经度转换为 UTM的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:在 Java 中获取地理位置的最佳方法 下一篇:如何在度、分、秒之间转换为十进制坐标

                  相关文章

                  最新文章

                    • <bdo id='MLwXf'></bdo><ul id='MLwXf'></ul>

                    <tfoot id='MLwXf'></tfoot>

                    <small id='MLwXf'></small><noframes id='MLwXf'>

                    1. <legend id='MLwXf'><style id='MLwXf'><dir id='MLwXf'><q id='MLwXf'></q></dir></style></legend>
                      <i id='MLwXf'><tr id='MLwXf'><dt id='MLwXf'><q id='MLwXf'><span id='MLwXf'><b id='MLwXf'><form id='MLwXf'><ins id='MLwXf'></ins><ul id='MLwXf'></ul><sub id='MLwXf'></sub></form><legend id='MLwXf'></legend><bdo id='MLwXf'><pre id='MLwXf'><center id='MLwXf'></center></pre></bdo></b><th id='MLwXf'></th></span></q></dt></tr></i><div id='MLwXf'><tfoot id='MLwXf'></tfoot><dl id='MLwXf'><fieldset id='MLwXf'></fieldset></dl></div>