Reference accommodations by Apple Maps Place ID with a name and coordinate snapshot
Decision
Store an Apple Maps Place ID as an accommodation's reference to the place. Next to it we keep a snapshot of the name and coordinate for display, plus the stay's dates and the user's notes. Address, phone number, website and opening hours stay with Apple Maps and are never copied into the trip. The Place ID is optional, so a place Apple Maps doesn't know can be entered by hand with only a name. A place reservation references its place the same way.
The app finds places with MapKit search and takes the Place ID from the chosen map item.
Why
A hotel's details change after the booking: phone numbers, websites, hours. A copy in our store goes stale, and refreshing it means paying a places API. A Place ID is Apple's stable identifier for a place. MapKit resolves it to current details on Apple platforms, and MapKit JS and the Maps Server API accept the same identifier, so a web client or the server could resolve it too.
The snapshot exists because a trip has to render offline and before any lookup returns. Name and coordinate are enough to draw a row and a map pin.
Rejected alternatives
- Store the full place details on each accommodation. They go stale and cost money to refresh.
- Require a Place ID. The trip has to accept a place Apple Maps doesn't list.
Consequences
Current details cost a MapKit lookup and a connection. Offline, and for a place entered by hand, only the snapshot is available. Nothing refreshes the snapshot when Apple renames a place.