Geospatial Query with Cosmos DB & Azure Data Factory — Location-aware automation with iPhone Shortcuts for Bus Arrival Timing
I rely on public transport to get around Singapore, so I always check the bus arrival time. There are many apps that offer this service, but they are not very convenient. I have to open the app and refresh it every time I want to know when the bus is coming. Plus, I don’t want to fill up my phone with unnecessary apps.
I decided to look for a way to automate the process based on my location. I have an iPhone, so I was thinking to use Shortcut to create this workflow:
- It runs automatically via trigger
- It gets my location from GPS, and finds the longitude and latitude
- It uses my location to find the closest bus stop
- It fetches the bus arrival time for that bus stop
- It shows me the arrival time
I was glad to find out that the Land Transport Authority of Singapore had APIs that could help me with this. From a technical perspective, I needed:
- A database that could store and query geolocation data and find the nearest location. I stored all the bus stop information here
- An endpoint that could call and combine the bus arrival APIs