What is a place ID?
A place ID is a string identifier returned in theid() field of a Place record. You obtain place IDs from:
- Geocode results (
PlaceResults→Place.id()) - Search results (
SearchResponse→SearchResponsePlace) - Resolved autocomplete completions (
resolveCompletionUrlorresolveCompletionUrls)
Single place lookup
Callapi.lookupPlace(placeId) to fetch a Place by its ID. The default response language is en-US.
null or a blank string for the language, the SDK falls back to en-US.
Batch place lookup
To fetch multiple places in a single request, usePlaceLookupInput and api.lookupPlaces(). The result is a PlacesResponse that separates successful results from errors.
PlaceLookupInput builder options
PlaceLookupInput.builder(ids) accepts a List<String> of place IDs. The list must not be empty; an IllegalArgumentException is thrown otherwise.
| Method | Type | Description |
|---|---|---|
.language(String) | BCP 47 tag | Response language. Defaults to en-US when omitted or blank. |
PlacesResponse structure
| Field | Type | Description |
|---|---|---|
results() | List<Place> | Successfully resolved places. |
errors() | List<PlaceLookupError> | IDs that could not be resolved, with an error code. |
errors() when performing batch lookups — the response may contain partial results if some IDs are invalid or no longer exist.
Alternate ID lookup
Place IDs can change over time when Apple Maps updates its data.api.lookupAlternateIds() resolves a list of known IDs to their current canonical counterparts.
AlternateIdsInput.builder(ids) takes a List<String> of place IDs. The list must not be empty.
AlternateIdsResponse structure
| Field | Type | Description |
|---|---|---|
results() | List<AlternateIdsEntry> | Resolved alternate ID mappings. |
errors() | List<PlaceLookupError> | IDs that could not be resolved. |
Place record fields
All three lookup operations returnPlace objects (directly or inside response wrappers):
| Field | Type | Description |
|---|---|---|
id() | Optional<String> | Canonical place ID. |
alternateIds() | List<String> | Other known IDs for this place. |
name() | String | Place name. |
coordinate() | Location | Latitude and longitude. |
formattedAddressLines() | List<String> | Display-ready address lines. |
structuredAddress() | Optional<StructuredAddress> | Parsed address components. |
displayMapRegion() | Optional<MapRegion> | Suggested map viewport. |
country() | String | Country name. |
countryCode() | String | ISO country code, e.g. "US". |