Skip to content

Conversation

@geoffreysflaminglasersword

No description provided.

@esm7
Copy link
Owner

esm7 commented Jul 26, 2021

Awesome feature!
I'd love to review it properly and merge it soon, but it's hard to see the changes because it seems like you have a JS formatter different than mine, and it generated a huge diff for many files that weren't actually changed. Do you mind cleaning these up so the actual changes become visible?

@geoffreysflaminglasersword
Copy link
Author

Awesome feature!
I'd love to review it properly and merge it soon, but it's hard to see the changes because it seems like you have a JS formatter different than mine, and it generated a huge diff for many files that weren't actually changed. Do you mind cleaning these up so the actual changes become visible?

Oh, my bad, yeah I'll clean that up

@esm7
Copy link
Owner

esm7 commented Jul 27, 2021

Since parsing the image locations seems to be too slow, I suggest making a cache mechanism that can also be useful for further file types in the future.
What I had in mind is a cache object (as part of the plugin config I guess), in the rough structure of -

type FileCache = {
  path: string,
  checksum: string,
  location: leaflet.LatLng
};

You can re-parse the file contents only if the file checksum changes from what's in the cache, and maintain the cache if files get deleted or renamed.
This way you are actually starting a mechanism that can be extended for various file types with various handlers -- the handler that you wrote that will handle image files, a different handler that will handle GPX files as requested here and so on! 😎

@geoffreysflaminglasersword
Copy link
Author

So it's not quite what you outlined (yet), I mostly just had time to get things working.
I tested out the caching on files from https://github.com/drewnoakes/metadata-extractor-images
Specific things to make sure are working on your machine:

  • open a vault and map view, drag a directory with images into the vault directory
    • ideally the markers would show up real time, currently you have to navigate back/forward from another note or reopen the view (I'm not sure why, as it updates real time when opening obsidian, just not when files are created/destroyed)
  • navigate forward and back between the map view and a note, it should be instantaneous
  • drag the image directory back out and see that the markers are removed (again, you'll have to reopen the view to see changes)
  • make sure other stuff still works
    • Tag filtering should still work
    • "set as default" is currently broken because of the changes, if you have time to check it out that'll save me some time (I won't be able to get to it immediately)

@esm7
Copy link
Owner

esm7 commented Aug 5, 2021

Just wanted to say that I'm sorry for not getting to this yet. I really want this integrated and will do my best to get to it soon enough!

@geoffreysflaminglasersword
Copy link
Author

Just wanted to say that I'm sorry for not getting to this yet. I really want this integrated and will do my best to get to it soon enough!

No worries! Take all the time you need
I haven't looked into Obsidian Leaflet much, but considering their announcement on adding gpx support, maybe you should consider attempting to merge this plugin's functionality with theirs? I haven't investigated that, not sure how feasible, but just a thought

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants