基本信息
源码名称:C# 百度LBS云存储/云检索 接口封装SDK源码下载
源码大小:0.02M
文件格式:.zip
开发语言:C#
更新时间:2015-05-12
友情提示:(无需注册或充值,赞助后即可获取资源下载链接)
嘿,亲!知识可是无价之宝呢,但咱这精心整理的资料也耗费了不少心血呀。小小地破费一下,绝对物超所值哦!如有下载和支付问题,请联系我们QQ(微信同号):78630559
本次赞助数额为: 2 元×
微信扫码支付:2 元
×
请留下您的邮箱,我们将在2小时内将文件发到您的邮箱
源码介绍
public partial class BaiduLBSYunSDK
{
#region geo POI... Point of interest
#region Post
public BadiuLBSYunResult poiCreate(double longitude, double latitude, UInt32 coordType, string geotableId, Hashtable columnKeyValue = null,
string title = null, string address = null, string tags = null)
{
string paraUrlCoded = "longitude=" longitude "&latitude=" latitude "&coord_type=" coordType "&geotableId=" geotableId
"&ak=" _ak;
if (!string.IsNullOrEmpty(title))
{
paraUrlCoded = ("&title=" title);
}
if (!string.IsNullOrEmpty(address))
{
paraUrlCoded = ("&address=" address);
}
if (!string.IsNullOrEmpty(tags))
{
paraUrlCoded = ("&tags=" tags);
}
if (!string.IsNullOrEmpty(_sn))
{
paraUrlCoded = ("&sn=" _sn);
}
if (columnKeyValue != null)
{
foreach (DictionaryEntry kv in columnKeyValue)
{
paraUrlCoded = ("&" kv.Key "=" kv.Value);
}
}
byte[] postData = System.Text.Encoding.UTF8.GetBytes(paraUrlCoded);
HttpWebResponse response = netWork(
method: BadiuLBSYunMethods.POST,
entity: BadiuLBSYunEntitys.POI,
operation: BadiuLBSYunOperations.CREATE,
postData: postData
);
Stream s = response.GetResponseStream();
StreamReader sr = new StreamReader(s);
string json = sr.ReadToEnd();
JavaScriptSerializer jss = new JavaScriptSerializer();
BadiuLBSYunResult re = jss.Deserialize<BadiuLBSYunResult>(json);
return re;
}
public BadiuLBSYunResult poiUpdate(UInt64 id, double longitude, double latitude, UInt32 coordType, string geotableId, Hashtable columnKeyValue = null,
string title = null, string address = null, string tags = null)
{
//自定义唯一索引key Value 用户自定义类型 page 32
//columnKeyValue includ index key value
string paraUrlCoded = "longitude=" longitude "&latitude=" latitude "&coord_type=" coordType "&geotableId=" geotableId
"&ak=" _ak "&id=" id;
if (!string.IsNullOrEmpty(title))
{
paraUrlCoded = ("&title=" title);
}
if (!string.IsNullOrEmpty(address))
{
paraUrlCoded = ("&address=" address);
}
if (!string.IsNullOrEmpty(tags))
{
paraUrlCoded = ("&tags=" tags);
}
if (!string.IsNullOrEmpty(_sn))
{
paraUrlCoded = ("&sn=" _sn);
}
if (columnKeyValue != null)
{
foreach (DictionaryEntry kv in columnKeyValue)
{
paraUrlCoded = ("&" kv.Key "=" kv.Value);
}
}
byte[] postData = System.Text.Encoding.UTF8.GetBytes(paraUrlCoded);
HttpWebResponse response = netWork(
method: BadiuLBSYunMethods.POST,
entity: BadiuLBSYunEntitys.POI,
operation: BadiuLBSYunOperations.UPDATE,
postData: postData
);
Stream s = response.GetResponseStream();
StreamReader sr = new StreamReader(s);
string json = sr.ReadToEnd();
JavaScriptSerializer jss = new JavaScriptSerializer();
BadiuLBSYunResult re = jss.Deserialize<BadiuLBSYunResult>(json);
return re;
}
public BadiuLBSYunResult poiDelete(UInt64 id, string geotableId, Hashtable indexKeyValue = null, string ids = null,
string title = null, string bounds = null, string tags = null)
{
//自定义唯一索引key Value 用户自定义类型 page 32
//indexKeyValue includ uniqueIndex key-value
string paraUrlCoded = "ak=" _ak "&id=" id;
if (!string.IsNullOrEmpty(ids))
{
string p = @"^(\d ,*) $";
Regex reg = new Regex(p, RegexOptions.IgnoreCase);
Match m = reg.Match(ids);
if (!m.Success)
{
throw new Exception("ids contains illegal characters.");
}
paraUrlCoded = ("&ids=" ids);
}
if (!string.IsNullOrEmpty(title))
{
paraUrlCoded = ("&title=" title);
}
if (!string.IsNullOrEmpty(bounds))
{
paraUrlCoded = ("&bounds=" bounds);
}
if (!string.IsNullOrEmpty(tags))
{
paraUrlCoded = ("&tags=" tags);
}
if (!string.IsNullOrEmpty(_sn))
{
paraUrlCoded = ("&sn=" _sn);
}
if (indexKeyValue != null)
{
foreach (DictionaryEntry kv in indexKeyValue)
{
paraUrlCoded = ("&" kv.Key "=" kv.Value);
}
}
byte[] postData = System.Text.Encoding.UTF8.GetBytes(paraUrlCoded);
HttpWebResponse response = netWork(
method: BadiuLBSYunMethods.POST,
entity: BadiuLBSYunEntitys.POI,
operation: BadiuLBSYunOperations.DELETE,
postData: postData
);
Stream s = response.GetResponseStream();
StreamReader sr = new StreamReader(s);
string json = sr.ReadToEnd();
JavaScriptSerializer jss = new JavaScriptSerializer();
BadiuLBSYunResult re = jss.Deserialize<BadiuLBSYunResult>(json);
return re;
}
public BadiuLBSYunResult poiUpload(UInt32 geotableId, byte[] poi_list, UInt32 timestamp = 0)
{
string paraUrlCoded = "ak=" _ak "&geotableId=" geotableId;
if (timestamp != 0)
{
paraUrlCoded = ("×tamp=" timestamp);
}
byte[] postData = System.Text.Encoding.UTF8.GetBytes(paraUrlCoded);
HttpWebResponse response = netWork(
method: BadiuLBSYunMethods.POST,
entity: BadiuLBSYunEntitys.POI,
operation: BadiuLBSYunOperations.UPLOAD,
postData: postData
);
Stream s = response.GetResponseStream();
StreamReader sr = new StreamReader(s);
string json = sr.ReadToEnd();
JavaScriptSerializer jss = new JavaScriptSerializer();
BadiuLBSYunResult re = jss.Deserialize<BadiuLBSYunResult>(json);
return re;
}
#endregion
#region Get
public string poiList(string geotableId, UInt32 pageIndex = 0, UInt32 pageSize = 10, Hashtable indexKeyValue = null, string title = null, string bounds = null, string tags = null)
{
string paraUrlCoded = "ak=" _ak "&geotable_id=" geotableId "&page_index=" pageIndex "&page_size=" pageSize;
if (!string.IsNullOrEmpty(title))
{
paraUrlCoded = ("&title=" title);
}
if (!string.IsNullOrEmpty(bounds))
{
paraUrlCoded = ("&bounds=" bounds);
}
if (!string.IsNullOrEmpty(tags))
{
paraUrlCoded = ("&tags=" tags);
}
if (!string.IsNullOrEmpty(_sn))
{
paraUrlCoded = ("&sn=" _sn);
}
if (indexKeyValue != null)
{
foreach (DictionaryEntry kv in indexKeyValue)
{
paraUrlCoded = ("&" kv.Key "=" kv.Value);
}
}
string getData = "?" paraUrlCoded;
HttpWebResponse response = netWork(
method: BadiuLBSYunMethods.GET,
entity: BadiuLBSYunEntitys.POI,
operation: BadiuLBSYunOperations.LIST,
getData: getData
);
Stream s = response.GetResponseStream();
StreamReader sr = new StreamReader(s);
string json = sr.ReadToEnd();
return json;
//JavaScriptSerializer jss = new JavaScriptSerializer();
//BadiuLBSYunResult re = jss.Deserialize<BadiuLBSYunResult>(json);
//return re;
}
public string poiDetail(UInt64 id, int geotableId)
{
//百度地图LBS云存储APIv3.0接口说明文档.doc
//geotable_id 表主键 int32 必须 page 33 ?
string paraUrlCoded = "ak=" _ak "&geotable_id=" geotableId "&id=" id;
if (!string.IsNullOrEmpty(_sn))
{
paraUrlCoded = ("&sn=" _sn);
}
string getData = "?" paraUrlCoded;
HttpWebResponse response = netWork(
method: BadiuLBSYunMethods.GET,
entity: BadiuLBSYunEntitys.POI,
operation: BadiuLBSYunOperations.DETAIL,
getData: getData
);
Stream s = response.GetResponseStream();
StreamReader sr = new StreamReader(s);
string json = sr.ReadToEnd();
return json;
//JavaScriptSerializer jss = new JavaScriptSerializer();
//BadiuLBSYunResult re = jss.Deserialize<BadiuLBSYunResult>(json);
//return re;
}
#endregion
#endregion
}