Example #1
0
        /// <summary>
        /// 距离测量
        /// </summary>
        /// <param name="distanceParam">距离测量参数</param>
        /// <returns>距离测量结果</returns>
        public string DistanceOriginalMeasure(DistanceParam distanceParam)
        {
            string getUrl = GaoDeConst.WebAPIHost + "/v3/distance?{0}";
            string paras  = distanceParam.GenerateParams();

            getUrl = string.Format(getUrl, paras);
            string distanceResult = WebRequestHelper.HttpGet(getUrl);

            return(distanceResult);
        }
Example #2
0
        /// <summary>
        /// 距离测量
        /// </summary>
        /// <param name="distanceParam">距离测量参数</param>
        /// <returns>距离测量结果</returns>
        public DistanceResult DistanceMeasure(DistanceParam distanceParam)
        {
            distanceParam.output = "JSON";
            string jsonResult = DistanceOriginalMeasure(distanceParam);

            if (!string.IsNullOrWhiteSpace(jsonResult))
            {
                jsonResult = jsonResult.Replace("[]", "\"\"");
            }
            DistanceResult distanceResult = JsonConvert.DeserializeObject <DistanceResult>(jsonResult);

            return(distanceResult);
        }