Dataview plugin snippet showcase

Sure. Basically, I have a folder People/Friends & Family where I put my TOC (Table of Contents) file and the single people’s notes.

In my “TOC” note, I have a leaflet map, centered on a theoretical “midpoint” of Germany, so I get a nice view, plus a list of people:

---
tags: friends, family
---

[[+Home]]

---

# Friends & Family TOC
This is the Table of Contents of your friends & family.

​```leaflet
height: 500px
lat: 51.133333
long: 10.416667
minZoom: 1
maxZoom: 18
defaultZoom: 5
​```

The list is sorted by last modified time, newest at top.

​```dataview
table birthday as "Birthday", file.ctime as Created, file.mtime as "Last modified"
from "People/Friends & Family"
where file.name != this.file.name
sort file.mtime descending
​```

You can then create some different markers in the settings of Obsidian leaflet (check Docs): I made “Friends”, “Family” and “Location” under Additional Map Markers.

Then simply zoom into the map, right-click and create new markers, specifying the map marker type and the linked note, or (quite cumbersome still)

  • export the current leaflet data csv,
  • add entries manually (people notes referred to must already exist), and
  • import the CSV again.

The CSV basically looks like this (check docs):

People/Friends & Family/+Friends & Family TOC.md/real,Family,51.133333,10.416667,Matthias C. Hormann,,
People/Friends & Family/+Friends & Family TOC.md/real,Friends,51.133333,10.416667,Friend 1,,
People/Friends & Family/+Friends & Family TOC.md/real,Location,52.52134162768218,13.41327381161729,Berlin Weltzeituhr,,3f4981d8-1615-4905-9cc4-e4df122215be

If you leave out the GUID in the last column, it gets created by Leaflet automatically. The locations given here are fake values, of course (except for the “Weltzeituhr” in Berlin).

You may need to refresh the note containing the map after import, to make it show all markers.

My “people” notes are really simple and just have the “calculated” links at top:

---
location: [51.133333,10.416667]
birthday: 1970-07-11
tags: friends
---

[[+Friends & Family TOC]]

`= elink("https://www.google.com/maps/search/?api=1&query=" + this.location[0] + "," + this.location[1], "Google Maps")` `= elink("https://www.google.com/maps/@?api=1&map_action=pano&viewpoint=" + this.location[0] + "," + this.location[1], "Street View")` `= elink("https://www.google.com/maps/dir/?api=1&dir_action=navigate&destination=" + this.location[0] + "," + this.location[1], "Route")`

---

# Friend 1
\* `= this.birthday` (`= (date(today) - this.birthday).years + " Jahre"`)

This will later have the correct links and look like this:

Clicking on the “Route” link, for instance, then opens the Google Route Planner in your browser (from which you could click “Send to my smartphone” and get instant navigation):

Hope that helps!

7 Likes