Overview
The Place API is a simple interface for returning a certain POI data for a region and providing a single POI query service. The user can send requests using C #, C ++, Java and other development languages and receive json, xml data.
Place API has full support for HTTP / HTTPS two forms of request. Subsequent introduction to HTTP request as an example.
Features:-
The Place API provides a regional search for POI services and POI details services.
- Area search POI service provides three regional retrieval methods:
City Search (corresponding to JavaScriptAPI’s Search method)
Rectangle search (corresponding to the SearchInBound method of the JavaScript API)
Round area search (corresponding to JavaScript’s SearchNearBy method). - POI Details Service provides detailed information on individual POI inquiries, such as praise.
Instructions for use:-
Use restrictions:
Place API is a free API interface, the number of calls limited to 100,000 times / day.
Ak is the API request string required parameters, please get the key , if not Baidu account first need to register Baidu account.
HTTP / HTTPS requests under the same account, quota, concurrent sharing.
Hello, World example:
The following is a simple example of the place API, set the search city for Beijing, retrieve the keyword “hotel”, retrieve 10 data after the search.
Http : //api.map.baidu.com/place/v2/search?q= Hotel & region = Beijing & output = json & ak = your_key
Place service address:-
Baidu Map Place API Service Address:
Http : //api.map.baidu.com/place/v2/search // v2 place zone search POI service
Http : //api.map.baidu.com/place/v2/detail // v2 POI details service
Composition Description:
Domain name: api.map.baidu.com
Service name
Service version number: v2 version of the new parameters than the previous version.
Place method name: such as search that area POI query, detail that POI details.
Place area to retrieve POI services:-
Service Address:
Http : //api.map.baidu.com/place/v2/search
Place area to retrieve common interface parameters
The following parameters apply to the Place API for the three regional retrieval methods.
Code Description:
For the query and region parameters, because these two parameters can be Chinese or some special characters (such as: spaces), for example: query can take “snacks”, region can be “Beijing”, in order to avoid submitting to the background garbled , So the two parameters for the value of the encoding process, encoding UTF-8 characters in two characters hexadecimal value. Query and region parameters when the value of the characters are not in the table below to be encoded.
If the query and region parameters are used to preserve the literal characters of the word characters, for example, the query keyword takes the value of “snack”, the search keyword contains a question mark, which must also be encoded, “?” Hexadecimal Is “% 3F”, so the entire search keyword “snack” is encoded as “% 3F% E5% B0% 8F% E5% 90% 83”.
Note:
- javascript in general use encodeURIComponent function to encode special characters.
- Java can use the function URLEncoder.encode to encode special characters.
- C # can use the function HttpUtility.UrlEncode to encode special characters.
- php can use the function urlencode to encode special characters.
Place Search example:
Search within the city
Http : //api.map.baidu.com/place/v2/search?query= bank & page_size = 10 & page_num = 0 & scope = 1 & region = Beijing & output = json & ak = {your key}
Rectangle area retrieval
Http : //api.map.baidu.com/place/v2/search?query= food & page_size = 10 & page_num = 0 & scope = 1 & bounds = 39.915,116.404,39.975,116.414 & output = json & ak = {your key}
Circular area retrieval
Http : //api.map.baidu.com/place/v2/search?query= Hotel & page_size = 10 & page_num = 0 & scope = 1 & location = 39.915,116.404 & radius = 2000 & output = json & ak = {your key}
// multiple keywords and cohort search
http : //api.map.baidu.com/place/v2/search?query= hotel $ bank & scope = 2 & output = json & location = 39.915,116.404 & radius = 2000 & filter = sort_name: distance | sort_rule: 1 & ak = {your key}
Place area search method
The Place API provides three types of search methods for cities, rectangles, and circles based on the type of regions that are supported for retrieval. The instructions are as follows:
Retrieve request parameters in the city
City search example (return json data):
Http : //api.map.baidu.com/place/v2/search?query= Baidu Mansion & region = `Shenzhen & city_limit = true & output = json & ak = {your key}
Rectangle area retrieval parameters
Rectangle search example (return json data):
Http : //api.map.baidu.com/place/v2/search?query= Bank & bounds = 39.915,116.404,39.975,116.414 & output = json & ak = {your key}
Round area search parameters
Round area search example (return xml data):
Http : //api.map.baidu.com/place/v2/search?query= Bank & location = 39.915,116.404 & radius = 2000 & output = xml & ak = {your key}
The Place API retrieves the returned result field
The result field (in the resultset of a data, for example, gray that extended field):
Place Search Service
Service Address:
Http : //api.map.baidu.com/place/v2/detail
Provides detailed information about a POI point, such as praise, evaluation, etc.
Request Parameter Description:
The return value is the same as the Place API search return result field.
Service example:
Http : //api.map.baidu.com/place/v2/detail?uid=5a8fb739999a70a54207c130&output=json&scope=2&ak= {your key}
return value:
{ "Status" : 0 , "Message" : "the ok" , "Result" : { "name" : "Baidu building staff canteen" , "LOCATION" : { "LNG" : 116.308022 , "LAT" : 40.056892 } , " address " : " Tenth Street (near brilliant international) Haidian District 10 " , " Detail " : 1 , " UID " : " 5a8fb739999a70a54207c130 " , " detail_info " : { " Tag " : " dishes; the other " , " detail_url " : " Http://api.map.baidu.com/place/detail?uid=5a8fb739999a70a54207c130&output=html&source=placeapi_v2 " , " type " : " cater " , " price " : " 11.0 " , " overall_rating " : " 4.0 " , " taste_rating " : " 4.0 " , " service_rating " : " 4.0 " , " environment_rating " : " 4.0 " , " IMAGE_NUM " : " 2 " , " comment_num " : ". 8 " , " shop_hours " : " As early as 9:00 To "8" , "atmosphere" : "" , "featured_service" : "" , "recommendation" : "Mala Tang, grilled fish" , "description" : "Store introduction :" } } }