• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java CRSFactory类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.osgeo.proj4j.CRSFactory的典型用法代码示例。如果您正苦于以下问题:Java CRSFactory类的具体用法?Java CRSFactory怎么用?Java CRSFactory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



CRSFactory类属于org.osgeo.proj4j包,在下文中一共展示了CRSFactory类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: fromHK80toWGS84

import org.osgeo.proj4j.CRSFactory; //导入依赖的package包/类
private static Pair<Double, Double> fromHK80toWGS84(Pair<Double, Double> pair) {
    try {
        // reference: blog.tiger-workshop.com/hk1980-grid-to-wgs84/
        CoordinateTransformFactory ctFactory = new CoordinateTransformFactory();
        CRSFactory csFactory = new CRSFactory();
        CoordinateReferenceSystem HK80 = csFactory.createFromParameters("EPSG:2326", "+proj=tmerc +lat_0=22.31213333333334 +lon_0=114.1785555555556 +k=1 +x_0=836694.05 +y_0=819069.8 +ellps=intl +towgs84=-162.619,-276.959,-161.764,0.067753,-2.24365,-1.15883,-1.09425 +units=m +no_defs");
        CoordinateReferenceSystem WGS84 = csFactory.createFromParameters("WGS84", "+proj=longlat +datum=WGS84 +no_defs");
        CoordinateTransform trans = ctFactory.createTransform(HK80, WGS84);
        ProjCoordinate p = new ProjCoordinate();
        ProjCoordinate p2 = new ProjCoordinate();
        p.x = pair.first;
        p.y = pair.second;
        trans.transform(p, p2);
        return new Pair<>(p2.x, p2.y);
    } catch (IllegalStateException e) {
        Timber.e(e);
    }
    return null;
}
 
开发者ID:alvinhkh,项目名称:buseta,代码行数:20,代码来源:BusRouteStopUtil.java


示例2: transform

import org.osgeo.proj4j.CRSFactory; //导入依赖的package包/类
/**
 * Convert geometry to different coordinate system given the source/target
 * proj4 parameters. Presumably these were pulled from SPATIAL_REF_SYS.
 *
 * @param geom
 * @param srcParams
 * @param tgtParams
 * @return
 * @throws FunctionExecutionException
 */
public static Geometry transform(Geometry geom, 
                                 String srcParams, 
                                 String tgtParams) 
        throws FunctionExecutionException {
    
    CoordinateTransformFactory ctFactory = new CoordinateTransformFactory();
    CRSFactory crsFactory = new CRSFactory();
    
    CoordinateReferenceSystem srcCrs = crsFactory.createFromParameters(null, srcParams);
    CoordinateReferenceSystem tgtCrs = crsFactory.createFromParameters(null, tgtParams);
    
    CoordinateTransform coordTransform = ctFactory.createTransform(srcCrs, tgtCrs);

    return transformGeometry(coordTransform, geom);
}
 
开发者ID:kenweezy,项目名称:teiid,代码行数:26,代码来源:GeometryTransformUtils.java


示例3: latlon2twd67

import org.osgeo.proj4j.CRSFactory; //导入依赖的package包/类
public static ProjCoordinate latlon2twd67(LatLng latLng) {

        CoordinateTransformFactory ctFactory = new CoordinateTransformFactory();
        CRSFactory csFactory = new CRSFactory();
        CoordinateReferenceSystem crs1 = csFactory.createFromParameters(EPSG_WGS84, FUNC_WGS84);
        CoordinateReferenceSystem crs2 = csFactory.createFromParameters(EPSG_TWD67, FUNC_TWD67);
        CoordinateTransform trans = ctFactory.createTransform(crs1, crs2);
        ProjCoordinate p1 = new ProjCoordinate();
        ProjCoordinate p2 = new ProjCoordinate();
        p1.x = latLng.longitude;
        p1.y = latLng.latitude;
        trans.transform(p1, p2);

        return p2;
    }
 
开发者ID:typebrook,项目名称:FiveMinsMore,代码行数:16,代码来源:ProjFuncs.java


示例4: setup

import org.osgeo.proj4j.CRSFactory; //导入依赖的package包/类
public void setup() {
  int sridSrc = sridSrcParam.value;
  sridTgt = sridTgtParam.value;

  org.osgeo.proj4j.CoordinateReferenceSystem srcCrs =
      new org.osgeo.proj4j.CRSFactory().createFromName("EPSG:" + sridSrc);

  org.osgeo.proj4j.CoordinateReferenceSystem tgtCrs =
      new org.osgeo.proj4j.CRSFactory().createFromName("EPSG:" + sridTgt);

  transform = new org.osgeo.proj4j.BasicCoordinateTransform(srcCrs, tgtCrs);
}
 
开发者ID:k255,项目名称:drill-gis,代码行数:13,代码来源:STTransform.java



注:本文中的org.osgeo.proj4j.CRSFactory类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ReservationUpdateResponse类代码示例发布时间:2022-05-23
下一篇:
Java WrappingLabel类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap