Exemplo n.º 1
0
        public void Test()
        {
            var client = ClientCreator.Create();

            var model = new CoordTransfModel
            {
                Coords = "114.21892734521,29.575429778924"
            };

            var req  = new CoordTransformRequest(model);
            var resp = client.Execute(req);

            resp.Status.ShouldBe(0);
        }
        /// <summary>
        /// 转换高德地理坐标为百度的地图坐标
        /// </summary>
        /// <returns></returns>
        public static IPPoint ConvertFromAmapGps(BaiduMapClient baiduClient, decimal longitude, decimal latitude)
        {
            var model = new CoordTransfModel
            {
                Coords = string.Format("{0},{1}", longitude, latitude),
                From   = CoordTransfModel.From_AMAP
            };
            var req  = new CoordTransformRequest(model);
            var resp = baiduClient.Execute(req);

            if (resp.Result != null && resp.Result.Count > 0)
            {
                return(resp.Result[0]);
            }
            return(null);
        }