POI Search
PoiSearch Class
Search for geographic information about relevant locations
Constructor | Description |
---|---|
nimap.service.PoiSearch(PoiSearchOptions) |
PoiSearchOptions | Type | Description |
---|---|---|
city | String | Required, search for the city (name/adcode), example "Beijing" or "110000" |
pageSize | Integer | The number of returns per page. The default is 10, and the range is 1-15. |
sort | String | Default sort: default. Distance ascending: dis|ASC; rank ascending order: rank|ASC; rank descending:rank|DESC; |
lonlat | String | Search based on current location latitude and longitude (for search result sorting only), If lonlat is empty, get the center point of current city. |
exinfo | String | Returns the location details control, ranging from 1-3. 1: return basic information; 2: return location details; 3: return location details, but no subnode information |
panel | String|HTMLElement | HTML container id or container element for the result list , after providing this parameter, the result list will be displayed in this container. Optional |
map | Map | nimap.Map object, a map instance showing the results. When this parameter is specified, the location annotations for the search results are automatically added to this map. Optional |
Method | Return Value | Description |
---|---|---|
search(keyword:String,function(result)) | Search by keywords. | |
searchAround(keyword:String,range:<Object>,function(result)) | Nearby query based on latitude, longitude, radius and keywords of the center pointRadius value range: 0-50000, default 1000 meters. For example {center:"116.12321,39.123231",radius:"2000"} | |
searchInPolygon(keyword:String,lonlats:<Array>,function (result)) | Search for range based on rectangular latitude and longitude and keywords. Longitude and latitude are separated by "," The coordinate pairs are separated by ";". Pass in the top left and bottom right vertex coordinate pairs. For example: "116.12, 39.21; 114.21, 38.21" or [["116.21","39.21"],["114.21","38.21"]] | |
searchInLine(keyword:String,range:<Object>,function(result)) | according to The navigation line latitude and longitude and keywords are searched along the way, for example: range={limit:"20000", radius:"3000", route:[lonlats]}. Limit: Defines the length of the route. The default is 20000 meters. Search by the route from the starting point to the limit length distance. Radius: search radius, in units of 1-1000, default 3000 meters | |
getDetail(id,function(result)) | Get location details based on location information id. | |
getCPDetail(cpInfo:<Object>,cpsearch:<Object>,function(result)) | Search for third-party hotels, attractions, food and more based on cpid, cpnm. cpInfo={cpid:40101008,cpnm:"Elong"}, hotel-specific search cpsearch={startTime:2018-2-12,endTime:yyyy-mm-dd} | |
setLocation(lonlats) | Set the current location (only for search results). | |
setCity(city) | Set the search city. | |
setSort() | Set the return result collation | |
setExinfo() | Set whether to return location details. | |
setPageSize() | Set the number of results returned per page. | |
clear() | Clear the annotations and results displayed on the map. |