esm7 / obsidian-map-view

Interactive map view for Obsidian.md
MIT License
546 stars 25 forks source link

"Add geolocation (front matter)..." barfs when property exists with any value or no value. #248

Open jordanmills opened 3 weeks ago

jordanmills commented 3 weeks ago

If there is a value it does not recognize as a geocode:

Unknown front matter location format:  Location {ancestorOrigins: DOMStringList, href: 'app://obsidian.md/index.html', origin: 'app://obsidian.md', protocol: 'app:', host: 'obsidian.md', …}

If the property exists with no value/null value:

Error converting location in file note.md: TypeError: Cannot read properties of null (reading 'match')
    at getFrontMatterLocation (plugin:obsidian-map-view:41324:56)
    at eval (plugin:obsidian-map-view:41170:34)
    at Generator.next (<anonymous>)
    at eval (plugin:obsidian-map-view:70:71)
    at new Promise (<anonymous>)
    at __awaiter (plugin:obsidian-map-view:66:12)
    at buildAndAppendFileMarkers (plugin:obsidian-map-view:41164:12)
    at eval (plugin:obsidian-map-view:41199:19)
    at Generator.next (<anonymous>)
    at fulfilled (plugin:obsidian-map-view:67:58)

If the property exists and the location is recognized as a valid geolocation it silently fails.

It's more of an FR than a bug, but it would also be nice if the plugin could work with or even better output human-readable place names with the geocoding results. Such as, if I search for "new york", and the suggestion I accept is "New York, U.S." it will output

40.7127281,-74.0060152

but it would be great if the output were

New York, U.S. [40.7127281,-74.0060152]
esm7 commented 2 weeks ago

Thank you, will fix.