Journelly and OSM for Emacs are good together
I mentioned OSM for emacs briefly before, but I haven’t played with it much. That’s because the maps never showed up correctly in the buffer: the map tiles were not aligned correctly and some appeared blank.
As it turns out, someone else had this problem and also found the culprit: visual-line-mode. I have it turned on by default as the majority of my work in Emacs involves org-mode and I need my lines wrapped in the buffer. With visual-line-mode disabled, OSM works as expected, including zooming in and out. Good stuff.
Now that I fixed OSM, I was wondering about something else I wanted to do for a while: having Journelly’s latitude and longitude fed automatically to OSM in Emacs, so I can view the location on a map.
Journelly captures locations and weather information for each note and stores those under properties, like so:
PROPERTIES:
:LATITUDE: ##.##########
:LONGITUDE: ##.##########
:WEATHER_TEMPERATURE: 62.1°F
:WEATHER_CONDITION: Cloudy
:WEATHER_SYMBOL: cloud
:END:
The OSM function that calls for those is osm-goto.
So what we need is a simple function to feed the properties values directly:
(defun jtr-goto-from-properties ()
(interactive)
(let ((lat (org-entry-get (point) "LATITUDE"))
(lon (org-entry-get (point) "LONGITUDE")))
(if (and lat lon)
(osm-goto (string-to-number lat) (string-to-number lon) osm-default-zoom)
(message "No LATITUDE/LONGITUDE properties found on this entry"))))
This is an interactive function that I use when I’m standing on the header in Journelly I want to see on a map. It’s quick and works well. Now I can use my Journelly entries, which are already in org-mode, as a base for a post with a map tile inside Emacs. OSM doesn’t have a native function to export an image, but since I usually want to annotate the image anyway before I make a post out of it, a regular screen-capture app is a good solution, at least for now.