首页 / 浏览问题 / 移动GIS / 问题详情
84,4527,3857这几中坐标之间转换的代码示例?
9EXP 2023年05月22日
使用产品:imobile 11i for Android
数据类型: 84,4527,3857
问题详细描述:因为转换坐标方法参数的可选项太多,麻烦给一下84,4527,3857这几中坐标之间转换的代码示例?

1个回答

您好,请问那边要转换数据坐标系还是地图开启动态投影呢
3,735EXP 2023年05月23日
转换数据坐标系
可以参考以下代码哈

PrjCoordSys Prj = new PrjCoordSys();

        //如果目标坐标系不在imobile坐标系枚举常量里面,就需要从字符串读取
        Prj.fromXML("<sml:CoordinateReferenceSystem>\n" +
                "<sml:Name>3Degree GK Zone 38N    (CGCS2000)</sml:Name>\n" +
                "<sml:Type>21688</sml:Type>\n" +
                "<sml:EPSGCode>4547</sml:EPSGCode>\n" +
                "<sml:SRS/>\n" +
                "<sml:Units>METER</sml:Units>\n" +
                "<sml:DistUnits>METER</sml:DistUnits>\n" +
                "<sml:GeographicCoordinateSystem>\n" +
                "<sml:Name>GCS_China_2000</sml:Name>\n" +
                "<sml:Type>37313</sml:Type>\n" +
                "<sml:EPSGCode>4490</sml:EPSGCode>\n" +
                "<sml:Units>DEGREE</sml:Units>\n" +
                "<sml:DistUnits>METER</sml:DistUnits>\n" +
                "<sml:ProjectionHeight>0.0000000000</sml:ProjectionHeight>\n" +
                "<sml:HorizontalGeodeticDatum>\n" +
                "<sml:Name>D_China_2000</sml:Name>\n" +
                "<sml:Type>39313</sml:Type>\n" +
                "<sml:Spheroid>\n" +
                "<sml:Name>CGCS2000</sml:Name>\n" +
                "<sml:Type>7044</sml:Type>\n" +
                "<sml:SemiMajorAxis>6378137</sml:SemiMajorAxis>\n" +
                "<sml:InverseFlattening>298.257222101</sml:InverseFlattening>\n" +
                "</sml:Spheroid>\n" +
                "</sml:HorizontalGeodeticDatum>\n" +
                "<sml:PrimeMeridian>\n" +
                "<sml:Name>Greenwich</sml:Name>\n" +
                "<sml:Type>8901</sml:Type>\n" +
                "<sml:PrimeMeridian>0</sml:PrimeMeridian>\n" +
                "</sml:PrimeMeridian>\n" +
                "</sml:GeographicCoordinateSystem>\n" +
                "<sml:MapProjection>\n" +
                "<sml:Name>Gauss_Kruger</sml:Name>\n" +
                "<sml:Type>43005</sml:Type>\n" +
                "</sml:MapProjection>\n" +
                "<sml:Parameters>\n" +
                "<sml:FalseEasting>500000</sml:FalseEasting>\n" +
                "<sml:FalseNorthing>0</sml:FalseNorthing>\n" +
                "<sml:CentralMeridian>114</sml:CentralMeridian>\n" +
                "<sml:StandardParallel1>0</sml:StandardParallel1>\n" +
                "<sml:StandardParallel2>0</sml:StandardParallel2>\n" +
                "<sml:ScaleFactor>1</sml:ScaleFactor>\n" +
                "<sml:CentralParallel>0</sml:CentralParallel>\n" +
                "<sml:Azimuth>0</sml:Azimuth>\n" +
                "<sml:FirstPointLongitude>0</sml:FirstPointLongitude>\n" +
                "<sml:SecondPointLongitude>0</sml:SecondPointLongitude>\n" +
                "<sml:RectifiedAngle>0</sml:RectifiedAngle>\n" +
                "</sml:Parameters>\n" +
                "</sml:CoordinateReferenceSystem>");

//如果使用的就是常见坐标系,可以直接从imobile坐标系常量里面获取

Prj.setType(PrjCoordSysType.*)

            Point2Ds points = new Point2Ds();
            points.add(point2D);
            PrjCoordSys desPrjCoorSys = new PrjCoordSys();
            desPrjCoorSys.setType(PrjCoordSysType.PCS_EARTH_LONGITUDE_LATITUDE);
            CoordSysTranslator.convert(points, desPrjCoorSys, Prj, new CoordSysTransParameter(), CoordSysTransMethod.MTH_GEOCENTRIC_TRANSLATION);
            point2D = points.getItem(0);//此处为转化结果
十分感谢
...