项目4 Java-将坐标从WGS84转换为EPSG4141?

项目4 Java-将坐标从WGS84转换为EPSG4141?,java,proj,Java,Proj,我使用的Proj.4Java库可以 我非常不确定如何在Proj.4JS中实现这样的代码: // include the library <script src="lib/proj4js-combined.js"></script> //adjust the path for your server //or else use the compressed version /

我使用的Proj.4Java库可以 我非常不确定如何在Proj.4JS中实现这样的代码:

// include the library
<script src="lib/proj4js-combined.js"></script>  //adjust the path for your server
                                                 //or else use the compressed version
// creating source and destination Proj4js objects
// once initialized, these may be re-used as often as needed
var source = new Proj4js.Proj('EPSG:4326');    //source coordinates will be in Longitude/Latitude, WGS84
var dest = new Proj4js.Proj('EPSG:4141');     //destination coordinates in meters, global spherical mercators projection, see http://spatialreference.org/ref/epsg/3785/


// transforming point coordinates
var p = new Proj4js.Point(-76.0,45.0);   //any object will do as long as it has 'x' and 'y' properties
Proj4js.transform(source, dest, p);      //do the transformation.  x and y are modified in place

//p.x and p.y are now EPSG:3785 in meters
//包含该库
//调整服务器的路径
//或者使用压缩版本
//创建源和目标Proj4js对象
//一旦初始化,它们可以根据需要重复使用
var source=new Proj4js.Proj('EPSG:4326')//源坐标将以经度/纬度WGS84为单位
var dest=新项目4js.Proj('EPSG:4141')//目标坐标(米),全局球形墨卡托投影,请参见http://spatialreference.org/ref/epsg/3785/
//转换点坐标
var p=新项目点(-76.0,45.0)//任何对象只要具有“x”和“y”属性,都可以
Proj4js.transform(源、目标、p)//进行转换。x和y被就地修改
//p、 x和p.y现在是EPSG:3785米
我对所有投影科目都是新手,我真的很想知道我在做什么。我需要将坐标系从WGS84转换为EPSG:4141,但Proj.4Java库根本没有文档记录,我无法真正了解如何使用它


有人对此很熟悉吗?

不幸的是,该库仍然没有很好的文档记录,因此对于仍在搜索解决方案的用户:

CRSFactory factory = new CRSFactory();
CoordinateReferenceSystem srcCrs = factory.createFromName("EPSG:4326");
CoordinateReferenceSystem dstCrs = factory.createFromName("EPSG:4141");

BasicCoordinateTransform transform = new BasicCoordinateTransform(srcCrs, dstCrs);

// Note these are x, y so lng, lat
ProjCoordinate srcCoord = new ProjCoordinate(-76.0, 45.0);
ProjCoordinate dstCoord = new ProjCoordinate();

// Writes result into dstCoord
transform.transform(srcCoord, dstCoord);

如果您需要了解其他任何信息,请访问源代码。

我在geotools上花了一天时间,终于来到这里!