Shortcuts Location from latitude and longitude

Given a latitude and longitude, is it possible to get a Location? Is there a magic formatting for Text feeding Get Addresses From Input?

As far as I can tell there’s no way to do this in the system. However using the LocationIQ Reverse Geocoding API you can accomplish the same thing.

You can get an Api key here and see an example of a shortcut I built using it here

Out of interest, what are you then using the location for in Shortcuts?

I use it to get name of city, region and such. But it doesn’t work when the shortcut is executed via Siri :sob:

The question was specifically to @seacycle … but are you saying you would enter long and lat to get a region and city in a shortcut and then do something with that? Not derive from current location, map place, street address, etc?

I’m a frequent traveller on the Washington State Ferries, and they have an API. Being able to press a button in my car, holler “Next Boat” and have Siri speak an actually useful response is really, really useful. With basic functionality done, there are lots more things I’d like to feed into the response. Like where am I in relationship to the terminal and how long, realistically, it will take to get there. If there are any schedule disruption alerts I should know about. By looking up the location (latitude & longitude) of the ferry, seeing if it can, realistically, be on-schedule. And assorted other factors.

Apple Maps actually has the ferry schedule, but it can’t be summoned by Siri, and it isn’t visually exposed in CarPlay. There are other apps that have the ferry schedule, but don’t incorporate any of the nuances I’d like (and are not integrated with Siri). I’ve found one, CityMapper, that is Siri Shortcut aware, and can actually read the next sailing, but isn’t quite what I want.

A variety of the WSDOT Traveler Info API return lat-lon information and it would be dandy to easily factory a Location object with lat-lon. I’ll have a look at the LocationIQ API as a near term solution.

My other goals are to use this as a driver to learn Shortcuts. I’ve dabbled with Workflow in the past, but never hit on a “killer app” to gain sufficient momentum in using it to become proficient. One thing is clear: using separate shortcuts as callable functions/subroutines isn’t going to scale well. And that I need to work out a sane caching pattern for APIs that return essentially static data. (One hopes the location of your ferry terminal doesn’t change too often…)

@mbkjeldsen, yes, I’ve noticed some of the Map functions do indeed not work when invoked via Siri, which may stall many of the things I’d like to do. I haven’t exhaustively investigated which do and don’t though.

If I understand correctly, you want to use your current position (which you could use with the Get Location action) to determine how long to the terminal … which presumably has an address you could use with something like the Get Distance action,or to set-up Waze, etc.

In terms of the ferry, it sounds like the position is being retrieved as longitude and latitude from the API you mentioned. Given that the ferry terminal is at a static latitude and longitude, these details could be used to determine the distance between the two points using say a haversine based calculation. Based on an approximate average speed of the ferry (you could watch a some journeys and calculate this), you could get a rough timing and then add extra time for mooring and disembarking as appropriate.

I think that would get you started on what you want, but without the need to convert a latitude/longitude couple into a Shortcuts location.

In terms of using separate custom shortcuts as separate functions, I would suggest that it is practical; well, for me it is.

The challenge many users get when looking at this is understanding how best to pass in parameters. For me simply adding to a variable and passing that in to the Run Shortcut action suffices - input to the action is passed to the shortcut. For example if I had a haversine calculation (which I’d probably opt to have the app do for Shortcuts), I’d probably create a variable that consisted of four items (two pairs of latitude & longitude), passed that to my haversine shortcut which split out the four items, processed them and then simply returned the result at the end, which is then passed to the calling shortcut.

Hope some of that helps.

Having a Get Travel Time action causes Siri on HomePod (and I presume CarPlay, but not yet tested) to punt and say You’ll need to continue on iPhone. :frowning_face:

My morning routine app will only provide me location based info (eg weather forecast) if run directly from the Shortcuts app or day view. If run via Siri it returns nothing in those steps.

I must be misunderstanding, but "Get current location”gets longitude and latitude, and you can search for things like city and state with syntax like {Current Location:City}.

At least the coordinates are GPS based, so should not require connectivity, though I assume the rest of the stuff probably will.