esm7 / obsidian-map-view

Interactive map view for Obsidian.md
MIT License
607 stars 32 forks source link

Request - More complex location formats #50

Open gentlegiantJGC opened 2 years ago

gentlegiantJGC commented 2 years ago

It would be great to be able to specify polygons rather than individual points in some cases to specify an area rather than just a point.

gentlegiantJGC commented 2 years ago

I have been working towards implementing this myself. My plan is to implement support for the geoJSON format embedded in the file (and perhaps in the front matter). This seems to make the most sense since it requires the least amount of work and does not introduce a new propitiatory format.

I have so far been working through all the code to understand what it does and where I would need to implement the logic. I have been commenting and adding docstings in order to make it easier to understand.

I think I am close to implementing geoJSON alongside your location system.

Just wondering if you have any thoughts on the embedded format.

my current plan is geoJSON:{} and geoJSON:[] where the array or object at the end is the geoJSON data.

I think tags would be put in like this geoJSON:tag1:tag2:{} and geoJSON:tag1:tag2:[]

esm7 commented 2 years ago

Hey,

Thanks for the cool suggestion and thanks even more for picking it up :sunglasses:

First, please note that last week I finished some massive refactoring of the plugin (to allow better state encapsulation together with the introduction of a "presets" functionality). I didn't push it because I didn't yet get to update the README, screenshots etc, but I think it's important that you merge with the updated version, so I'll do my best to push it today or tomorrow, even if to a side branch.

Second, regarding the syntax, I understand why your plan makes sense when the geoJSON is in the front matter. But when it's in the content of the note, it might be better to use a standard Markdown code block that starts with ```geojson. At least when it is inside the content of the note, it might be better to support tags within the geoJSON as a "tags": ... key. Note that in this case, I think it's also important to require the locations key in the front matter, so Map View won't need to parse all notes to search for embedded geoJSONs.

gentlegiantJGC commented 2 years ago

Okay. That might make it interesting to merge since I have also changed quite a bit.

Tags in the JSON data would only work if the root type is an object but geoJSON can also be an array. I thought the geoJSON spec said not to extend the format but it does allow arbitrary keys https://datatracker.ietf.org/doc/html/rfc7946#section-6.1

I was planning to require the key in the front matter to enable embedded data.

Can I request that we move front matter keys under a single key. Adding more keys to the root will get cluttered and may cause conflicts with other plugins. I think geoJSON can just be in the root since that is a standard and other plugins can share that. I think all other keys related to this plugin should be under a key like map_data (obviously keeping support for the location and locations keys in the root) The inline behaviour could be triggered either by the presence of the map_data key or perhaps an inline key under map_data

gentlegiantJGC commented 2 years ago

In order to implement this there are a number of things that must be implemented first. I previously implemented these as one pull request but the changes became too large to merge. I will open a feature request for each required component and link back to here.

rui-nar commented 1 year ago

hi everyone, I would like to plan my (very long) bike trips using Obsidian but I absolutely need a way to store itineraries/routes (a 10km difference in route when you're cycling to a camping ground makes all the difference LOL). So I was wondering if this feature is progressing? Or maybe stuck somewhere ?

many thanks

esm7 commented 1 year ago

No one has been working on it recently, and I admit to not have the time to progress with it myself right now :(

esm7 commented 1 year ago

BTW, worth noting here that the thing that concerns me the most about this feature is not the part of displaying GPX data (that's relatively easy, especially after some generalization @gentlegiantJGC did), but the GUI of interacting with them. We'd need some additional filters for the marker type and other search/query-related tools that would prevent the GPX files from weighting down on the maps when they're not wanted, and some way to control their visual look based on some properties (directory, name or other filters).

gentlegiantJGC commented 1 year ago

I won't be developing this any further. I have been developing a map extension tailored to my exact needs but it isn't a general solution like this. I would suggest looking into Geoman if you want to support more types.

esm7 commented 1 year ago

Geoman looks awesome, thank you!

rui-nar commented 1 year ago

Would you share your map extension? Does it do routings?

On Mon, May 1, 2023, 09:34 gentlegiantJGC @.***> wrote:

I won't be developing this any further. I have been developing a map extension tailored to my exact needs but it isn't a general solution like this. I would suggest looking into German if you want to support more types.

— Reply to this email directly, view it on GitHub https://github.com/esm7/obsidian-map-view/issues/50#issuecomment-1529442064, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACP6EX6RP5SBHGVNL2EPX2DXD5RRZANCNFSM5NTZNEHQ . You are receiving this because you commented.Message ID: @.***>

gentlegiantJGC commented 1 year ago

It has a number of issues.

https://github.com/TowerOfLondonArchive/obsidian-earth-view

Make a geojson code block on a page and it should show the editor when you view it