Mobile: Can Obsidian API provide current geo location (GPS) on Android/iOS?

Use case or problem

Easily get at the current geo position (GPS) on a mobile device that runs Obsidian.
Mainly to update a “current location” note, for use with the Obsidian Leaflet maps.

Proposed solution / current workaround

On my laptop, I use Templater to update a “Current Location” note by calling a Python script that evaluates my current geo location (from the laptop’s GPS or IP address).

I’d very much like to see that on the mobile version, so I could have a “live view” of my Obsidian Leaflet maps. It’s of course not that easy on a smartphone: Users have to consent reading the GPS location, and I wonder if it’s available in Typescript/Javascript, instead of running external code.

So the best bet would be that the Obsidian API could support that functionality and provide some means for a plugin (or JS code) to read out the location data, i.e. at least latitude and longitude (WGS 84), maybe even elevation (meters).

Thus, plugins like Obsidian Leaflet maps could use it directly, and notes using Templater and/or Dataview scripting could also use it.

Is that possible? Or planned?

I feel this could be a real cool feature.

Related feature requests (optional)


There are some NPM packages dealing with geolocation. E.g., geolocation - npm

I don’t know what would happen if a plugin tried to use them on mobile, though. I imagine it would just fail silently…

Looks like Capacitor has an official geolocation plugin. Would probably be better to use that for mobile.

On desktop, the Google API key has to be set and have Geolocation permissions in Electron to use Chromium’s geolocation API. See here.

1 Like


So on Android you have to get a Google API key for a function that the phone’s hardware provides.

Ridiculous scheme, eh? Getting the data from almost everyone for free and making them pay (for many requests) to be able to access their own data!


1 Like

I’d love to see this feature. One thing I like about Evernote is the metadata in every note: I know when and where each note was composed. If I could have this info in a template in Obsidian, that would be great.

1 Like

It would be great to get accurate GPS location, but this is what I’m doing on mobile for general location using Templater. It requires an internet connection, and will insert a placeholder (or blank) if none is available.

Works great on desktop or mobile. Templater script:

return Promise.race([
    new Promise((resolve) => {
            .then(response => response.json())
            .then(data => resolve([, data.regionName,].filter(x => !!x).join(', ')))
    new Promise((resolve) =>
        // If we haven't fetched the location within 300ms,
        // time-out and resolve with the placeholder text instead
        setTimeout(() => resolve('Location'), 300)
1 Like

How would you use this with Obsidian Leaflet? Glancing at the docs for that plugin, I don’t see an easy way for it to import locations from multiple notes.