esm7 / obsidian-map-view

Interactive map view for Obsidian.md

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Custom labels for inline geo links

devinbaillie opened this issue · comments

If I have a note with multiple geolocations, is there any way to give them labels other than the note name?

Maybe I'm missing something simple, but if I put:

[](geo:78.33720203451263,-44.6484375)

I get a pin on the map view in the middle of Greenland, but it's labelled with the note title. Is there any way to give this location a custom label, such as "Middle of Greenland"?

commented

Yes, you can give the link itself a name, e.g.
[Middle of Greenland](geo:78.33720203451263,-44.6484375)

Thanks for the response. That's how I figured it would work, but it's still labelled with the note title. See the attached screenshot. I guess this should be filed as a bug report then.
image

commented

I see how that I made this functionality work only on mobile, under the assumption that on desktop most people would use "show note preview on map marker hover", which shows much more context than the link name.
How about turning on this setting and seeing if it helps you?
If after that you will still think that the popup should include the link name, I will bring it back as a setting.

Thanks, I had that setting enabled, but didn't have the page preview core plugin enabled, so all I got was the title.

If I use just the note preview, it doesn't show the note name, and if I use both note name and note preview, it makes two separate popups. If there's a way to have the note name show up at the top of the note preview, it would be better, though I'm not sure how easy it would be to implement?

I'm making a map of my acreage and all the plant varieties I've got. I have several different varieties of apple trees, for one example. I originally figured that I would have one note named Apple Trees, with a link named for each variety so they show up correctly.

If I use the note name popup, then I need to move each of the links to their own note. Then I can link to them from the Apple Trees note.

If I use the note preview popup then for plants that only have one variety, the note title isn't included, so I have to put the plant into a header or something so it shows up in the popup.

I'm not sure which approach I will take yet, I need to see how I'm using the map going forward, whether I prefer the cleaner look of the small title popup or more context from the page preview popup. I suppose ideally, to make it as customisable as possible, I'd want the option of having the preview popup with a title that is an optional combination of note name, link name, both, or neither (if that makes sense?). Maybe even a way to set this in the embedded map options as opposed to a global setting (or to override the global settings?). That way I could use one popup setting for my acreage map, and a different one if I were planning a road trip or something.

I hope all this makes sense, and I don't come across as ungrateful. I appreciate all the work that goes into making this extension (seriously, thank you, I've been looking for a solution for mapping out my acreage for a while before I discovered this), and I can make it work as-is if you don't have time to add features just for my specific use case.

commented

Unfortunately the note preview is completely controlled by Obsidian, all Map View can do is mark the highlighted line, and I was unable to find a way to control it further (i.e. to display the note title).
But customizing Map View's own note popup (the one that currently shows just the title) is very doable, it actually used to be this way before I made the note preview. I'll bring it back.

That sounds great, thanks so much!

I'd definitely +1 this. Great plugin btw (sent some coffee). For inline stuff it isn't that useful for every marker just to show the note name - impossible to work out what each marker is (and the note preview hover shows nothing else no matter the setting). Should show both note name and the individual link name - maybe with a slightly smaller font, or over two lines (note//name)

In an ideal world what might be good as an alternative is to have a tag that generates a numbered marker e.g tag:1 would put a 1 in the marker. That way a bit of a legend could be created.

Whatever the case I am using several tags showing different addresses, and need at least some way to work out which is which.

PS: Even if I do enable the Page Preview Core Plugin (which I don't want to do) it doesn't really help to identify what the pin is - I just see a whole collection of geo links on the area of the relevant page. So definitely bring back the individual link name in the popup...

commented

I didn't have time to work on Map View in the last couple of weeks, but as soon as I get a chance to spend a few hours on it, there's not gonna be a next version without this one.

I just ran into this issue now. Some kind of customization would be really nice!

commented

In the upcoming days I'm planning to work a few hours on Map View and this will be included.

commented

Added in 3.0.2.

This sounds awesome @esm7 - I just updated the plugin but
URIs of the form
Piggle Road

on hover are still showing up all just with the containing file name, not the location
Unless there is a setting I missed

commented

@aubreyz there is a new setting under "Marker Hover & Previews": "show inline link name on marker hover".
You should set it to "always".
Let me know if it works as expected.

@aubreyz there is a new setting under "Marker Hover & Previews": "show inline link name on marker hover". You should set it to "always". Let me know if it works as expected.

Works as expected for me, thanks.

Ahh yes, with the setting on that's great.

Issue is the coloring of the popup. Obviously to do with my theme (which is just default albeit with some snippets)
The color of the File name and the link differ with the latter being nearly invisible. I'll need to work on what CSS is styling them but that's going to be a potential problem for some people.

image

Edit (reverting to the default theme with no snippets still seems very little contrast. No time to think further now...

commented

Can you try to add the following snippet and see if it solves the issue:

.map-view-marker-sub-name {
    color: var(--text-normal);
    font-size: var(--font-text-size);
    font-family: var(--font-text);
}

Yes that solves it completely - and useful to be able to size them. Would be useful to have a complete snippet of various stuff useful for maps.

commented

That's a great idea, I should document at some point the various CSS classes that can be customized.