坐标转换

2017-10-28  本文已影响51人  山华水清

近两天需要把平面坐标转换为标准的WGS84后使用百度逆地址编码
搜索出资料记录一下

  1. 类库 程序ProjNet4GeoAPI
    static void PtsToPts(ICoordinateSystem fromCS, ICoordinateSystem toCS,List<double[]> pts, out List<double[]> results)
   {
        CoordinateTransformationFactory ctfac = new CoordinateTransformationFactory();
        ICoordinateTransformation trans = ctfac.CreateFromCoordinateSystems(fromCS, toCS);
        results = trans.MathTransform.TransformList(pts);
   }
 static void Main(string[] args)
   {
        string bj1954Lcc= "……"; //见上文
        IProjectedCoordinateSystem fromCS = CoordinateSystemWktReader.Parse(bj1954Lcc) as IProjectedCoordinateSystem;
        GeographicCoordinateSystem toCS = GeographicCoordinateSystem.WGS84;

        double[] xPts = new double[4] { 20634500, 20635500, 20634500, 20635500 };
        double[] yPts = new double[4] { 4660000, 4660000, 4659000, 4659000 };

        List<double[]> pts = new List<double[]>();
        for (int i = 0; i < 4; i++)
        {
            double[] xy = new double[] { xPts[i], yPts[i] };
            pts.Add(xy);

        List<double[]> results = new List<double[]>();
        PtsToPts(fromCS, toCS, pts, out results);

        foreach (double[] result in results)
        {
            Console.WriteLine("{0},{1}", result[0], result[1]);
        }
   }
  1. 百度地图逆地址编码
    百度逆地理编码服务

  2. GDAL相关
    ...and...You can find the GDAL API documentation here
    There is an GDAL API tutorial here
    The OGR API documentation is here
    The OSR API documentation is here
    All the links you need for GDAL can be reached from http://www.gdal.org/
    All the links you need for OGR/OSR can be reached from http://www.gdal.org/ogr/
    下载编译后的GDAL地址
    参考资料:
    [类库地址,包含GeoAPI、proj4net、ProjNet4GeoAPI]
    (https://pan.baidu.com/s/1skMrbHF)
    DotSpatial.Projections Vs. ProjNET4GeoAPI
    星星分享

上一篇 下一篇

猜你喜欢

热点阅读