Baidu Place API

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.

  1. 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).
  2. 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.
baidu-table1

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.baidu-table2

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:

  1. javascript in general use encodeURIComponent function to encode special characters.
  2. Java can use the function URLEncoder.encode to encode special characters.
  3. C # can use the function HttpUtility.UrlEncode to encode special characters.
  4. 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 citybaidu-table3

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 parametersbaidu-table4

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):

baidu-table5

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

Status fieldbaidu-table6

The result field (in the resultset of a data, for example, gray that extended field):

baidu-table7

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:

baidu-table8

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 code appendix:-

baidu-table9

mm

Greeshma Borad Android Developer

I am an Android Developer at Yudiz Solutions Pvt. Ltd. - a leading mobile app development company. Android programming has been my passion since i started my carrier and like adopting new technologies to maximize development efficiency and produce innovative applications.

Comments are closed.

Top