javalent / obsidian-leaflet

Adds interactive maps to Obsidian.md using Leaflet.js
481 stars 29 forks source link

Feature Request: Autogenerate drawings on a map based on linked note's metadata #343

Open Sirs0ri opened 1 year ago

Sirs0ri commented 1 year ago

I'd like to see an option where I can define geometry in a Note's frontmatter, which is then used to create an (immutable) drawing on a map, similar to how the current markerFile / mapmarker syntax works. (Bonuspoints if this feature could get the same DataView Integration like markerFolder / markerTag)

My main usecase would be to insert automatically drawn lines over a map of our TTRPG world, showing points we travelled to.

The frontmatter syntax I have in mind would look something like this:

NoteWithCoordinates.md This map has the configuration of e.g. a travelled route as line, other shapes such as polygon / rectangle should follow a similar syntax. Only the yaml-part of the frontmatter is shown to keep things simple.

mapline:
  color: "#3388ff"
  coordinates: # ordered list of the line's points
   - [-19.3262, 6.7891]
   - [-12.1271, 7.0508]
   - [-8.1193, 8.3418]

NoteWithMap.md This would be the content of a leaflet-codeblock to render a map, embedded in a note

id: my-map-id
# config like image / bounds / zoom / scale / etc...
drawingFile: [[NoteWithCoordinates]]

Ideally, the drawn line would have a link back to the created note.