Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expand metadata in space - Geolocation coords support request #1371

Open
Tylannn opened this issue May 7, 2024 · 3 comments
Open

Expand metadata in space - Geolocation coords support request #1371

Tylannn opened this issue May 7, 2024 · 3 comments
Labels
enhancement New feature or request

Comments

@Tylannn
Copy link

Tylannn commented May 7, 2024

Is your feature request related to a problem? Please describe. A clear and
concise description of what the problem is. Ex. I'm always frustrated when [...]

No.

Describe the solution you'd like A clear and concise description of what you
want to happen.

Like any other tp usage, convert <% tp.coord.current("format") %> to coords in ISO 6709 format.

For example: <% tp.coord.current("±DD.DDDD±DDD.DDDD") %> will be +12.345-098.765.

Geolocation_API should be useful, and this is a minimal practise from W3C school:

<script>
const x = document.getElementById("demo");

function getLocation() {
  if (navigator.geolocation) {
    navigator.geolocation.getCurrentPosition(showPosition);
  } else {
    x.innerHTML = "Geolocation is not supported by this browser.";
  }
}

function showPosition(position) {
  x.innerHTML = "Latitude: " + position.coords.latitude +
  "<br>Longitude: " + position.coords.longitude;
}
</script>

Describe alternatives you've considered A clear and concise description of
any alternative solutions or features you've considered.

Not yet.

Additional context Add any other context or screenshots about the feature
request here.

This feature might be very useful, when people getting old and reading their notes or dairy, a geolocation coords will bring kind of memory. OpenStreetMap's API could convert coords to specific name.

@Tylannn Tylannn added the enhancement New feature or request label May 7, 2024
@McGlear
Copy link

McGlear commented Jun 8, 2024

If the documentation around accessing the GPS location within Obsidian using the map view plugin is still up to date, then Obsidian does not support accessing device location. Map view offers a workaround using a helper app. I would consider such approaches out of scope for Templater. However, I would assume you should be able to access Map View functions from within Templater scripts, as long as the desired functionality is provided as an Obsidian command. Have you tried that?

@Zachatoo
Copy link
Collaborator

In case it isn't clear on how to execute an Obsidian command.

You can get a list of the command IDs by opening the dev console (CMD Shift I) and typing app.commands.commands into the console.

This example will run the “Daily notes: Open today’s daily note” command.

<%*
app.commands.executeCommandById("daily-notes");
%>

@Tylannn
Copy link
Author

Tylannn commented Jun 11, 2024

I checked official document. It seems there's no way for add-ons to get geolocation or ask for it. And, yeah, access outside API is to much for templater.

May we could model obsidian leaflet's way? Let user input coords manually, most people don't change location frequently. But I'm not sure if it's worthy, too much input box looks messing.

And, apparently, user script can do this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants