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

Format location properties as numbers #4

Open
Kageetai opened this issue Jan 30, 2024 · 6 comments
Open

Format location properties as numbers #4

Kageetai opened this issue Jan 30, 2024 · 6 comments

Comments

@Kageetai
Copy link

Hey, I was just comparing this plugin to the obsidian map view plugin, which has similar functionality, but I like how your plugin adds more info to the notes.
But I did notice one major difference when adding the location info to the notes. Obsidian Map View formats the location property as numbers, but your plugin does so as strings.
I understand why you probably decided to use strings, as it shows the property properly within the Obsidian property tool and still keeps it editable, as this is exactly a problem Obsidian Map View actually has.
But this difference makes it incompatible to use your plugin with Obsidian Map View (although the Leaflet plugin still works), so I was wondering whether you could add a setting for the user to choose which format to apply when adding the frontmatter. Like let the user choose whether to format the values as strings or not.
Would that be possible? Thx

result.lat.toString(),
result.lng.toString(),

@jose-elias-alvarez
Copy link
Owner

Hmm, I'm not necessarily opposed to adding a new setting or a new property to handle this, but as you noted, using numbers instead of strings makes the property uneditable in Obsidian, since it doesn't know how to handle it:

image

Are you sure it wouldn't be better to solve this issue in Obsidian Map View?

@Kageetai
Copy link
Author

Yes, I know that neither is ideal, I just thought that the format with numbers instead of strings also somewhat makes more sense, as coordinates are numbers after all.
In the end, it would be good to be able to create custom property formats in Obsidian itself, as someone in the thread I linked above also suggested. But in the meantime, either plugin developers need to come up with their own fixes :/
Anyway, not a hard problem for me, just thought this side would be the easiest fix

@jose-elias-alvarez
Copy link
Owner

If for whatever reason the issue can't be solved in obsidian-map-view (the maintainer is unwilling or the plugin is unmaintained) then I'm open to adding an option here. (I see that the repo owner tagged the issue you linked in January, so hopefully putting in a fix there is an option, since I suspect it'll take quite a while before Obsidian allows custom property types.)

@Kageetai
Copy link
Author

Kageetai commented Feb 3, 2024

Yeah, makes sense. Maybe they can fix it there

@evanharmon1
Copy link

The map view plugin has a new version in the works related to these issues - https://github.com/esm7/obsidian-map-view/tree/v5.0

My opinion is that data like [lat,long] should be an array since it's easier to parse that way and I think Obsidian properties get confused in some cases if the literal [lat,long] string is in a string type property since it thinks its an array. So that would be my preference for how a plugin saves location data. But good config options for how the plugin does it would be great so we could do whatever.

Thanks for the plugin!

@sandervdvijver
Copy link

sandervdvijver commented Apr 13, 2024

An option in the config would be ideal for me too, as I would like to store them as [lat,long]as well.

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

No branches or pull requests

4 participants