esm7 / obsidian-map-view

Interactive map view for Obsidian.md
MIT License
546 stars 25 forks source link

Issues in "Properties" field #202

Closed architaktus closed 3 months ago

architaktus commented 9 months ago

for now, the "location" way has issues, but "locations:" way works great. Regarding the funny way of changing the "location:" filed that mentioned above, I was wondering, if it's a good idea to add one more option in right-click-menu: "change the location property in current file". which I think is a simple way to fix the first issue.

Thanks a lot for making and maintaining this great Plugin!

Xieleilab commented 9 months ago

the same problem after the ob version is updated to V1.4.5, the traditional way of adding loctions in font matter is not available

mfloreen commented 9 months ago

Same problems here. "Convert to Geolocation (geosearch)" isn't working for me either since updating to 1.4.5 (using Google API), but that could be a separate issue.

This is a great plugin! I'm surprised Obsidian didn't include "Location" (or "Coordinates"?) as a Property type.

mikescott commented 9 months ago

Same, I just opened Obsidian and it seems it's auto updated without asking me and this plugin no longer works properly. Existing notes show on the map, but the coordinates of new notes don't change orange and don't show on the map.

cjt3 commented 9 months ago

Same here. Until a fix is developed, a workaround is to use inline location URLs instead of frontmatter. From the documentation:

Another way that the plugin parses location data is through inline location URLs in the format of [link-name](geo:40.68,-74.04), which allow multiple markers in the same note. To prevent the need to scan the full content of all your notes, it requires an empty locations: tag in the note front matter ('locations' and not 'location').

esm7 commented 9 months ago

The Obsidian devs guaranteed that an API for plugins to define custom field types are coming, and hopefully this will bring back the ability to use the front matter as we're all used to. In the meantime, I am unsure why location is not recognized as a YAML list, as it should be...

It sounds like you all are editing the YAML manually, which I never do, which explains why I didn't run into this problem in spite of using "properties" for a very long time (I'm an Obsidian alpha tester, so been running with this even before it was available to insiders). AFAIK the tools for adding geolocations to a note work as usual -- I'm using "add geolocation (front matter)" on an almost-daily basis with no issues.

  1. Do I understand correctly, and is the issue indeed only when editing YAML manually?
  2. If so -- why do you all edit YAML manually? The way I see it, adding locations via the "add geolocation" command (or menu item in a note) is far easier. You can enter a location name or coordinates and it should work out of the box. Same goes for "new note here (front matter)" etc. If it doesn't work, I'd love to hear more details.
  3. I'm not happy about workarounds, but note that you can also use the Obsidian editor's "source view", which will also let you edit the YAML manually.
cjt3 commented 9 months ago
  1. If so -- why do you all edit YAML manually? The way I see it, adding locations via the "add geolocation" command (or menu item in a note) is far easier. You can enter a location name or coordinates and it should work out of the box. Same goes for "new note here (front matter)" etc. If it doesn't work, I'd love to hear more details.

I have found that many places I add don't show up in the search for "add geolocation", so I've gotten into the habit of just pasting coordinates from Google Maps into front matter directly (I have a place template that includes a blank "location:" in the front matter). I had not realized that I could paste the coordinates into the "add geolocation" search, so that fixes the problem I had been having. Thanks for that information!

esm7 commented 9 months ago

One of my goals in Map View is to make the flow as automatic as possible, so the more the plugin progressed, I was trying to minimize the occasions on which you would need to edit YAML fields or coordinates. Maybe I should give this more emphasis in the documentation. That being said, "properties" broke more than just the ability to edit the YAML, and I really hope the Obsidian devs would hold to their promise in exposing an API for field types.

architaktus commented 9 months ago

Thanks for the replies! Actually, the issue is about renew/editing the existed geolocation. It was easy to change a location (just copy and paste). But as all we all realized, the location field is not recognized and cannot be change.

but in my case, I have to change my geolocation (or move) sometimes and a compromised solution for me is

  • "new note here(front matter)", copy the field, place it in the original file after deleting the old one

(Answer to Q1: editing the YAML manually is just another compromised solution, but it's really not easy/ stupid.)

so regarding this way, I suggest, add one more option in right-click-menu: "change the location property in current file", so that we dont have to create a new file only to change a location. which I think would be a simple solution for now, and it remains a good small option for the guys who need to change their location even if the API comes and things works normal again. : )

esm7 commented 9 months ago

Another way to currently renew/edit a geolocation is to remove it (click the icon of the property and click "remove" in the menu) and re-add using the regular Map View command. That being said, it's not a replacement for better tools of modifying markers, nor instead of the need to have Obsidian recognize a geolocation property.

Comprehensive-Jason commented 9 months ago

I think this issue simply stems from Obsidian's YAML formatting requirements in list properties. For instance, using the following list properties to test produces:

location working:
  - "23.57"
  - "23.76"
location:
  - 23.57
  - 23.76
List Test:
  - "23"
  - "2345678"
  - "432.645334"
  - Bob
  - "[[Bob]]"
  - Bob the Builder
  - "#$@##%"

image

Obsidian wants " " around any numbers in list properties. However, adding quotations that way causes Map View to no longer recognize the numbers as a location. Couldn't the solution just be to make Map View recognize - "23.57" as equivalent to - 23.57 ?

Marco-Mindstone commented 7 months ago

Hi, any news about how to insert coordinates in property field?

esm7 commented 7 months ago

I'm not sure what's doable in my jurisdiction to improve direct editing of front matter coordinates, as the Obsidian props editor still hasn't introduced an API or support for geolocations. Ideas are very welcome. One thing I do have in mind, is that in the plugin's docs I can hint that editing coordinates manually is probably the least convenient way to add geolocations.

Satanniel commented 7 months ago

So since by default the location is added as [x,y], why don't have it added by default as "[x,y]"? It will be then recognised as a string and editable.

Comprehensive-Jason commented 7 months ago

@Satanniel I agree, this would fix the problem completely.

If this does not work for whatever reason, you could instead add the latitude and longitude as separate bullets in a list property, surrounded by quotations like Obsidian formatting needs. For example:

location: 
- "123.123"
- "456.456"
rchaklashiya commented 6 months ago

I have the same issue of not being able to change the location, but I came up with a workaround using a combination of the Commander plugin and the Linter plugin, which I hope may be helpful towards finding a more permanent solution. Here is what I did:

  1. In Linter plugin settings, turn off every setting except for “Remove the YAML keys specified” in the “YAML” section of the plugin settings.
  2. Still in the Linter plugin settings, in the “YAML Keys to Remove” setting, I set the key I wanted to remove. These two Linter steps effectively make the Linter do only one thing: remove the "location" property.
  3. In the Commander plugin settings, I went to the "Macros" tab and clicked "Add Macro."
  4. In that Macro, I added the following three commands: a) Linter: Lint the current file (which removes the "location" property of the current file) b) Delay (for 2050 milliseconds) (this is optional, but I added a small delay to make sure that the location adding command doesn't accidentally happen before the Linter has time to delete the location key) c) Map View: Add geolocation (front matter) to current note (this now allows you to add the geolocation to the current note, now that the old one has been deleted)
  5. Now just set a keyboard shortcut for the new macro made, and/or add it to the right-click menu, and/or add it to the file's menu (top right three vertical dots). It is now extremely easy to change the location of any note.

The weaknesses of this method I have just described are as follows:

  1. Creates a dependency on two other plugins
  2. Makes it not possible to use Linter plugin for anything else
  3. Still cannot copy the geolocation in a convenient way
esm7 commented 3 months ago

Should now be fixed as part of 5.0.0.