//新增数据
private void createPoi() throws UnsupportedEncodingException {
BaiduTest test = new BaiduTest();
HttpEntity reqEntity=null;
String url = "http://api.map.baidu.com/geodata/v3/poi/create";
List formparams = new ArrayList();
formparams.add(new BasicNameValuePair("longitude", "11111"));
formparams.add(new BasicNameValuePair("latitude", "111.222"));
formparams.add(new BasicNameValuePair("coord_type", "3"));
formparams.add(new BasicNameValuePair("geotable_id", "23456"));
formparams.add(new BasicNameValuePair("ak", "tgrfdredsrfedseds"));
reqEntity = new UrlEncodedFormEntity(formparams, "utf-8");
test.post(url,reqEntity);
}
//查询百度云所有数据
private static String li() throws Exception {
BaiduTest test = new BaiduTest();
String url = "http://api.map.baidu.com/geodata/v3/poi/list?geotable_id=1234&ak=asdfgasdfgsdf&coord_type=3&page_size=10000";
String a = test.httpGet(url);
return a;
}
//更新
private void updatePoi() throws UnsupportedEncodingException {
BaiduTest test = new BaiduTest();
String upurl = "http://api.map.baidu.com/geodata/v3/poi/update";
List formparams = new ArrayList();
formparams.add(new BasicNameValuePair("geotable_id", "12345"));
formparams.add(new BasicNameValuePair("ak", "asdfghjkdsfghsdf"));
formparams.add(new BasicNameValuePair("id", ""));
HttpEntity reqEntity = new UrlEncodedFormEntity(formparams, "utf-8");
test.post(upurl,reqEntity);
}
//删除
private static void deletePoi() throws UnsupportedEncodingException {
BaiduTest test = new BaiduTest();
String url = "http://api.map.baidu.com/geodata/v3/poi/delete";
List formparams = new ArrayList();
formparams.add(new BasicNameValuePair("geotable_id", "12345"));
formparams.add(new BasicNameValuePair("ak", "asdfghjklzxcv"));
//formparams.add(new BasicNameValuePair("is_total_del", "1"));
formparams.add(new BasicNameValuePair("id", "122233"));
HttpEntity reqEntity = new UrlEncodedFormEntity(formparams, "utf-8");
test.post(url,reqEntity);
}
//修改列
private static void updateColumn() throws UnsupportedEncodingException {
BaiduTest test = new BaiduTest();
String url = "http://api.map.baidu.com/geodata/v3/column/update";
List formparams = new ArrayList();
formparams.add(new BasicNameValuePair("geotable_id", "123456"));
formparams.add(new BasicNameValuePair("ak", "qwertyuioasdfghj"));
formparams.add(new BasicNameValuePair("id", "308806"));
formparams.add(new BasicNameValuePair("is_sortfilter_field", "0"));
formparams.add(new BasicNameValuePair("is_search_field", "1"));
formparams.add(new BasicNameValuePair("is_index_field", "1"));
formparams.add(new BasicNameValuePair("is_unique_field", "1"));
HttpEntity reqEntity = new UrlEncodedFormEntity(formparams, "utf-8");
test.post(url,reqEntity);
}
//查表
private static void listColumns() throws Exception {
BaiduTest test = new BaiduTest();
String url = "http://api.map.baidu.com/geodata/v3/column/list?geotable_id=1234&ak=qwertyuiAsdfsdfg";
String a = test.httpGet(url);
System.out.println(a);
}
具体请看文档,lbs.云存储:http://lbsyun.baidu.com/index.php?title=lbscloud/api/geodataV3