obsidian-map-view icon indicating copy to clipboard operation
obsidian-map-view copied to clipboard

[Feature request] - Marker icon rules - read from properties

Open pelegm opened this issue 1 year ago • 6 comments

The current marker rules only read note tags. In my workflow, I don't usually use tags, but rather properties (e.g., instead of tags:\n - campingsite I use types:\n - "[[Camping site]]"). To have special icons for various note types, I now add tags, but this duplicates some of my work. Is there any chance to support general properties in a future release?

pelegm avatar Jul 11 '24 08:07 pelegm

That's a really cool idea. How do you foresee the syntax for these properties? Making a generic rules mechanism for properties is probably far more excessive than for tags. Making a property for the icon is very easy, but might not be flexible enough for some users.

esm7 avatar Jul 11 '24 08:07 esm7

Thanks for the feedback!

I would probably not try to reinvent the wheel but instead use Obsidian's basic query rules. E.g., Screenshot from 2024-07-11 10-18-46

The [properyname:propertyvalue] syntax returns every note whose propertyname either equals propertyvalue or contains it as an element in a list. It also ignores the square brackets and is case-insensitive by default.

pelegm avatar Jul 11 '24 09:07 pelegm

Oh nice. I knew somewhere in the back of my head it exists but never tried it. Will look into it.

esm7 avatar Jul 11 '24 09:07 esm7

By the way, I would apply the same concept for filters - you already allow there most of what Obsidian's search allows. Shall I open a distinct issue for that?

pelegm avatar Jul 11 '24 09:07 pelegm

Unfortunately mimicking Obsidian's search is a pain. I discussed with the Obsidian developers years ago to provide an API to the search capabilities, they agree with the need but never came to it. So Map View has its own query mechanism, and if you think of other operators that could be useful, I prefer to cherry pick them than to play catch-up. (Regardless, to my understanding this is about to change soon, as Obsidian is about to introduce its own querying mechanism based on Data View. I'm hopeful it will have a formal API and Map View can plug into that.)

esm7 avatar Jul 11 '24 10:07 esm7

Sounds good. Thank you again so much! (bought you a coffee). I'll open a distinct issue for filtering in map view in terms of properties.

pelegm avatar Jul 11 '24 12:07 pelegm

i second the ability to set marker icon rules based on things other than tags (e.g. properties values, linkedto, linkedfrom)

i too use [[tags]] instead of #tags, so the Tags Pane is empty and there is zero #tag in the system. The natural way to get MapView to display custom markers will mean creating and using tags, and this will populate the Tags Pane with a inexhaustive list of tags (since some are inline as tag:tagname and not parsed in the global Tags Pane). So currently i think i prefer exclusively using locations: YMAL and inline tag:tagname for everything even it's a one-location-dedicated note; this is cleaner but not semantically optimal.

just some new perspective on this issue. amazing plugin ❤️

hdlnii avatar Apr 04 '25 16:04 hdlnii

I'm all for that. Hopefully at some point later this year, after we're through with GeoJSON, GPX support and such (which is the top user request for Map View), I can do an overhaul for how Map View does filtering and marker icons and incorporate much more sophisticated rule sets.

esm7 avatar Apr 09 '25 05:04 esm7

This now works in Map View 6.0.0 :)

esm7 avatar Oct 08 '25 14:10 esm7