Geospatial Query with Cosmos DB & Azure Data Factory — Location-aware automation with iPhone Shortcuts for Bus Arrival Timing

Marcus Tee
12 min readJul 17, 2023
Image created by Bing Image Creator, modified manually. Prompt: a young man holding an iPhone, standing at a bus stop. The iPhone screen is blank, digital art style.

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:

  1. It runs automatically via trigger
  2. It gets my location from GPS, and finds the longitude and latitude
  3. It uses my location to find the closest bus stop
  4. It fetches the bus arrival time for that bus stop
  5. 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:

  1. A database that could store and query geolocation data and find the nearest location. I stored all the bus stop information here
  2. An endpoint that could call and combine the bus arrival APIs

--

--