POI Details
Use POI details search to obtain the information about a point of interest.
To perform a call, you need to obtain a unique POI identifier and then use it to create a POIDetailsOptions
.
To obtain a unique POI identifier you could use fuzzy search with resultTypeSet
set to poi
.
You can request POI details in different languages. See the list of supported languages.
Specify the desired response language when creating a POIDetailsOptions
using a locale
parameter.
If no language is specified, categories will be returned in English.
1let amsterdamCenter = CLLocationCoordinate2D(latitude: 52.377956, longitude: 4.897070)2let poiOptions = SearchOptions(3 query: "Restaurant",4 geoBias: amsterdamCenter,5 resultTypeSet: [.poi]6)7onlineSearch.search(options: poiOptions) { [weak onlineSearch] result in8 switch result {9 case let .success(poiSearchResponse):10 let result = poiSearchResponse.results.first.flatMap { try? POIID(from: $0.id) }11 let options = POIDetailsOptions(12 poiID: result!,13 locale: Locale(identifier: "en_GB")14 )1516 onlineSearch?.requestPOIDetails(options: options) { result in17 switch result {18 case let .success(poiDetailsResponse):19 // handle success20 break21 case let .failure(error):22 // handle error23 break24 }25 }2627 case let .failure(error):28 // handle error29 break30 }31}
As a result, you will get a POIDetailsResponse
that contains SearchResult
with updated poi
property - SearchResult
poi property
More detailed information about this service can be found in the Search API Place by ID documentation.