Grab Your Current Location As Plain Text Using Pythonista And Drafts


This. Is. Rad
This. Is. Rad

Prepare to have you socks blown off, and to know the exact GPS coordinates of the exact spot where those socks land. How? With Dr. Drang’s new Pythonista scripts which grabs your current location and writes it down in plain-text form. Better still, it does this using the Drafts app, so you can add location stamps to anything you like – journal entries, notes, or even pictures of your socks, over there in the corner of the room.

Remember Pythonista? It’s the amazing iOS app that runs Python scripts on your iPad, and was the predecessor to developer/genius Ole Zorn’s amazing Editorial app, a text editor which pretty much contains Pythonista within it.

The last update to Pythonista added a location module that let users grab their current coordinates, and Dr Drang wrote up a Python Script – called – to use that module to grab a simple text readout of your current location. He describes it thusly:

It’s a simple little thing that’s meant to be called from Drafts. It appends the location—both the latitude/longitude coordinates and the address—to the current draft.

How would you use it? You could tap out a note in Drafts, then hit the switch to send it off to Pythonista, whereupon your location will be added to the note before sending you back to Drafts for sending to its final destination.

And, theoretically at least, you should be able to run this as a workflow inside Editorial. This could be useful for all kinds of reasons, although the only thing I can think of right now is when you’re writing a treasure hunt for nerdy kids.

[time passes…]

OK, I just tried the thing out, and it’s amazing. Setup is easy: just paste the good Doctor’s code into a new Pythonista script and add the supplied URL to Drafts as a URL action. The first time you use it Pythonista will prompt you to allow it to access your location, but after that you just tap, wait while it queries the GPS and looks up your address, then gasp in delight as it writes it down for you, ready to be sent as an iMessage, or added to a list of locations you have visited on vacation or a road/bike trip.

I can see myself using this as a way to add location logging to apps that don’t support location, or to just remember a place without having to snap a photo of it. Or any number of awesome things, really.

Source: And now it’s all this


Daily round-ups or a weekly refresher, straight from Cult of Mac to your inbox.

  • The Weekender

    The week's best Apple news, reviews and how-tos from Cult of Mac, every Saturday morning. Our readers say: "Thank you guys for always posting cool stuff" -- Vaughn Nevins. "Very informative" -- Kenly Xavier.