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

using obsidian:// as x,y,z tile server

Open zsviczian opened this issue 4 years ago • 3 comments

Do you think it is possible to configure leaflet.js to use a local folder in the vault as the maptile source?

https://github.com/esm7/obsidian-map-view/blob/527e04da87c2c0bf4553f1f429d5dda7fd12c0b1/src/mapView.ts#L205-L210

zsviczian avatar Jan 12 '22 12:01 zsviczian

In theory if the tiles URL is a local file, it should work... https://gis.stackexchange.com/questions/82936/how-i-can-load-tilelayer-in-leaflet-framework-using-local-tiles If this really works, the plugin can add a parser for obsidian:// URLs to convert them to a path using the Vault API.

esm7 avatar Jan 12 '22 12:01 esm7

Before raising the issue I did try file:///C:/path/tiles/{z}/{x}/{y}.png but just adding it in settings did not seem to work. I'd be happy with relative path or as you suggest, the plugin converting the obsidian:// link to a local link.

I wouldn't want to state an absolute file:// path, since I am using Obisidian on multiple devices including mobile and desktop...

zsviczian avatar Jan 12 '22 14:01 zsviczian

I am afraid loading files with a local file path will not work. This is the error I am getting if I set a local path within the vault: image

I also checked process.cwd(): returned the Obsidian install folder, then changed the working folder to the vault root with process.chdir(), and set a relative path as map source, but got exactly the same error.

image

Would be great to make it work somehow from the vault. Right now I am publishing my map via github pages, and that works fine.

zsviczian avatar Jan 14 '22 20:01 zsviczian