日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程语言 > java >内容正文

java

wgs utm java,Java,将经纬度转换为UTM

發布時間:2023/12/13 java 37 豆豆
生活随笔 收集整理的這篇文章主要介紹了 wgs utm java,Java,将经纬度转换为UTM 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

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.

解決方案

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]);

總結

以上是生活随笔為你收集整理的wgs utm java,Java,将经纬度转换为UTM的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。