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

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

    <tfoot id='W7UMz'></tfoot>

      • <bdo id='W7UMz'></bdo><ul id='W7UMz'></ul>
      <legend id='W7UMz'><style id='W7UMz'><dir id='W7UMz'><q id='W7UMz'></q></dir></style></legend>
    1. Java,将纬度/经度转换为 UTM

      Java, convert lat/lon to UTM(Java,将纬度/经度转换为 UTM)
      <legend id='YbQIc'><style id='YbQIc'><dir id='YbQIc'><q id='YbQIc'></q></dir></style></legend>
        <bdo id='YbQIc'></bdo><ul id='YbQIc'></ul>
      • <i id='YbQIc'><tr id='YbQIc'><dt id='YbQIc'><q id='YbQIc'><span id='YbQIc'><b id='YbQIc'><form id='YbQIc'><ins id='YbQIc'></ins><ul id='YbQIc'></ul><sub id='YbQIc'></sub></form><legend id='YbQIc'></legend><bdo id='YbQIc'><pre id='YbQIc'><center id='YbQIc'></center></pre></bdo></b><th id='YbQIc'></th></span></q></dt></tr></i><div id='YbQIc'><tfoot id='YbQIc'></tfoot><dl id='YbQIc'><fieldset id='YbQIc'></fieldset></dl></div>

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

          <tfoot id='YbQIc'></tfoot>
                  <tbody id='YbQIc'></tbody>
              • 本文介绍了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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                相关文档推荐

                How can I detect integer overflow on 32 bits int?(如何检测 32 位 int 上的整数溢出?)
                Local variables before return statements, does it matter?(return 语句之前的局部变量,这有关系吗?)
                How to convert Integer to int?(如何将整数转换为整数?)
                How do I create an int array with randomly shuffled numbers in a given range(如何在给定范围内创建一个随机打乱数字的 int 数组)
                Inconsistent behavior on java#39;s ==(java的行为不一致==)
                Why is Java able to store 0xff000000 as an int?(为什么 Java 能够将 0xff000000 存储为 int?)
                <tfoot id='icXsW'></tfoot>
                  <tbody id='icXsW'></tbody>
                    <bdo id='icXsW'></bdo><ul id='icXsW'></ul>

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

                      <legend id='icXsW'><style id='icXsW'><dir id='icXsW'><q id='icXsW'></q></dir></style></legend>

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