///// <summary> ///// 创建单条数据 ///// </summary> ///// <param name="option"></param> ///// <returns></returns> //public async Task<string> AMapYunTuCreate(AMapYunTuOption option) //{ // var data = string.Format("", option.Tableid, option.Loctype); // string contentType = "application/x-www-form-urluncoded"; // return await HttpConnect.PostCreateAsync(data,YunTunConfig.UrlCreate,contentType); //} ///// <summary> ///// 创建批量数据 ///// </summary> ///// <param name="option"></param> ///// <returns></returns> //public async Task<string> AMapYunTuBatchCreate(AMapYunTuOption option) //{ // var data = string.Format(""); // string contenType = ""; // return await HttpConnect.PostBatchCreateAsync(data, YunTunConfig.UrlBatchCreate, contenType); //} //public async Task<string> AMapYunTuUpdate(AMapYunTuOption option) //{ // var data = string.Format("key={0}&tableid={1}&loctype={2}&sig={3}",YunTunConfig.AMapKey,option.Tableid,option.Loctype,option.Sig); // string contenType = "application/x-www-form-urluncoded"; // return await HttpConnect.PostCreateAsync(data, YunTunConfig.UrlUpdate, contenType); //} /// <summary> /// 周边搜索 /// </summary> /// <param name="option"></param> /// <returns></returns> public async Task<string> AMapYunTuSearchAround(AMapYunTuOption option) { var data = string.Format( "tableid={0}&key={1}¢er={2}&keywords={3}&radius={4}&filter={5}&sortrule={6}&limit={7}&page={8}&sig={9}", option.Tableid,YunTunConfig.AMapKey,option.Center,option.Keywords,option.Radius,option.Filter,option.Sortule,option.Limit,option.Page,option.Sig); Task<string> result= HttpConnect.HttpWebRequestGet(YunTunConfig.UrlAround + data); //TODO:截取字符串,并解析,然后根据信息返回查询信息给用户 //{"count":"1","info":"OK","status":1,"datas":[ string heard = result.Result.Substring(0, result.Result.IndexOf("datas")); return await result; }
private async void Button_Click(object sender, RoutedEventArgs e) { YunTunConfig.AMapKey = "711d692f3aa45f9241367087a49bc2a9"; AMapYunTuOption option = new AMapYunTuOption(); option.Tableid = "531ae90be4b0aba456a136d5"; option.Center = "116.397743,39.9179"; option.Radius = 50000; option.Id = "11"; //option.Filter = "k"; option.Sortule = "_id:1"; AMapYunTu yunTu = new AMapYunTu(); string x = await yunTu.AMapYunTuSearchId(option); Debug.WriteLine(x); txtMsg.Text = x; }
/// <summary> /// ID搜索 /// </summary> /// <param name="option"></param> /// <returns></returns> public async Task<string> AMapYunTuSearchId(AMapYunTuOption option) { try { var data = string.Format( "tableid={0}&key={1}&_id={2}&sig={3}", option.Tableid, YunTunConfig.AMapKey, option.Id, option.Sig); return await HttpConnect.HttpWebRequestGet(YunTunConfig.UrlId + data); } catch (Exception ex) { return ex.Message; } }
/// <summary> /// 多边形搜索 /// </summary> /// <param name="option"></param> /// <returns></returns> public async Task<string> AMapYunTuSearchPolygon(AMapYunTuOption option) { var data = string.Format( "tableid={0}&key={1}&polygon={2}&keywords={3}&filter={4}&sortrule={5}&limit={6}&page={7}&sig={8}", option.Tableid, YunTunConfig.AMapKey, option.Polygon, option.Keywords, option.Filter, option.Sortule, option.Limit, option.Page, option.Sig); return await HttpConnect.HttpWebRequestGet(YunTunConfig.UrlAround + data); }