Geotagging capabilities for mobile

Use case or problem

Basic:
In my daily note for example I would like to be able to have the template include the location the note was created along with the date and time.

Would be cool:
Also on a more global level having a setting to enable geotagging on all new notes would be really cool.

Would be cool but probably overkill:
Adding the ability to view notes on a map and filter/search notes by location proximity.

Proposed solution

An additional template embedding similar to date and time could be added that reads the current device location. I am only familiar with iPhone development at the moment so I’m not sure about android, but the iOS CoreLocation framework seems to have the needed functionality. The user could then use some sort of string similar to the time formatting to specify the way the location is displayed. Corelocation has built in geocoding abilities that can get human readable addresses from raw location data so maybe something like {StreetAddres, City, State} would appear as “123 Something Street, Dallas, Texas”

Maybe the actual latitude/longitude coordinates could be written to the note along with the formatting string, that way you could change how you wanted the location to appear later. I’m just spitting out ideas here so I don’t want to go overboard.

Current workaround (optional)

In theory the iPhone Shortcuts app url scheme could be used to get the file path of the current note into a shortcut, then the shortcut could get the device location, format it accordingly, and append it to the file at the provided path. However I can see this getting messy easily.

1 Like

I agree that it would be amazing to get a proper location.

Here’s a way to get a rough location from your IP address, which you can add to your new note template (I’m using Templater for mine):

return Promise.race([
  new Promise((resolve) => {
    fetch('http://ip-api.com/json/')
      .then(response => response.json())
      .then(data => resolve([data.city, data.regionName, data.country].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('Unknown location'), 300)
  )
])

The Map View plugin provides an additional workaround for this problem. It can’t automatically add location to notes, but the author has created a web interface to grab the current location and pass it to Obsidian. See the GPS Location Support section for more details.