Baidu included on the map is a common location information, and if there are some special places are not included Baidu map, LBS Baidu cloud service provided allows us to easily own collection of location information (such as toilets attractions, etc.)
About LBS cloud
LBS is Baidu map for the launch of the LBS developer platform-level services, combined with the existing Maps API and SDK services through an open server storage and computing power, providing real-time location data mass storage, retrieval, display integrated solutions
1 implemented based LBS: Cloud storage 2, 3 retrieves the cloud, the cloud geocoding 4, an inverse cloud geographic coding
LBS application for registration and key
LBS using cloud services must have a Baidu account, after landing the account open LBS application cloud services, to use LBS
Cloud services must apply key
Key Application Types
Select the type of application required for the back-end application server; browser on the application by the end js code
Check the required service
Setting test mode and whitelist
Here ip address will be prompted to enter the wrong format (These are the server configuration) browser is slightly different
LBS quota management
Baidu offers certain quota for LBS cloud services, more than the amount necessary to spend money on free
This feature provides detailed flow chart and balances, and the management is very convenient. General test development and small-scale trial is sufficient, this is Baidu also did a good job.
LBS Download
Baidu provides a detailed description of the development, documentation and code examples available for download
Note LBS into cloud cloud cloud storage and retrieval
Cloud storage is a database-like DML statements responsible for the new, delete, and modify tables, queries the cloud to retrieve real data.
LBS build tables and insert data
LBS can click directly on the left side of the page insert according to Baidu map data
enter
You can point to the right of the Create button New Table
Create a table name
Setting field
LBS table default fields provided, in addition to the default field may be added manually
release
If you want to enable, to check
add information
Click the table data management
Click Add
According doji selected point on the map, and then fill in the information (general latitude and longitude do not change)
After saving into data stored
Background code calls
Reference Documents
@Test
// Create table geotable
public void demo1() throws ClientProtocolException, IOException {
1 // Create an object httpClient
HttpClient client = HttpClients.createDefault();
// 2, the request object
HttpPost httpPost = new HttpPost( "http://api.map.baidu.com/geodata/v3/geotable/create");
// 3, binding parameters
List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(); nameValuePairs.add(new BasicNameValuePair("name", "javaee41")); nameValuePairs.add(new BasicNameValuePair("geotype", "1"));
nameValuePairs.add(new BasicNameValuePair("is_published", "1")); nameValuePairs.add(new BasicNameValuePair("ak",
"a9F3QkTyeoyKAt2iR5irH2xRzWSBaqzk"));
// name=mytable4&geotype=1
httpPost.setEntity(new UrlEncodedFormEntity(nameValuePairs, Charsets.UTF_8));
// 4, the transmission request
HttpResponse httpResponse = client.execute(httpPost);
// 5, print the resulting data
HttpEntity httpEntity = httpResponse.getEntity(); System.out.println(EntityUtils.toString(httpEntity));
}
@Test
// lookup table
public void demo2() throws ClientProtocolException, IOException {
1 // Create an object httpClient
HttpClient client = HttpClients.createDefault();
// 2, the request object
HttpGet httpGet = new HttpGet(
"http://api.map.baidu.com/geodata/v3/geotable/list?ak=a9F3QkTyeoyKAt2iR5i rH2xRzWSBaqzk");
// 3, transmits a request
HttpResponse httpResponse = client.execute(httpGet);
// 4, print the resulting data
HttpEntity httpEntity = httpResponse.getEntity(); System.out.println(EntityUtils.toString(httpEntity));
}
@Test
// lookup table
public void demo4() throws ClientProtocolException, IOException {
1 // Create an object httpClient
HttpClient client = HttpClients.createDefault();
// 2, the request object
HttpGet httpGet = new HttpGet(
"http://api.map.baidu.com/geodata/v3/column/list?ak=a9F3QkTyeoyKAt2iR5irH 2xRzWSBaqzk&geotable_id=191874");
// 3, transmits a request
HttpResponse httpResponse = client.execute(httpGet);
// 4, print the resulting data
HttpEntity httpEntity = httpResponse.getEntity(); System.out.println(EntityUtils.toString(httpEntity));
}
@Test
// lookup table
public void demo5() throws ClientProtocolException, IOException {
1 // Create an object httpClient
HttpClient client = HttpClients.createDefault();
// 2, the request object
HttpGet httpGet = new HttpGet(
"http://api.map.baidu.com/geodata/v3/poi/list?ak=a9F3QkTyeoyKAt2iR5irH2xR zWSBaqzk&geotable_id=191874");
// 3, transmits a request
HttpResponse httpResponse = client.execute(httpGet);
// 4, print the resulting data
HttpEntity httpEntity = httpResponse.getEntity(); System.out.println(EntityUtils.toString(httpEntity));
}