On Mon, May 6, 2013 at 9:06 AM, Christian Moe <m...@christianmoe.com> wrote:
> PS. If Org were to add a default geo: link type, I think it would make > sense to keep the parameters to a minimum, i.e. just the latitude and > longitude, without backend-dependent options such as Google Maps' "spn" > parameter. Though I can see how it would be useful. Good point, agreed. So what I am trying to do is less about a link type "geo location" but more about possibly having several different visualizations of one single geo location. > When link abbreviations do not suffice, you can always write a link > definition in Lisp and add it with org-add-link-type. Thinking about this and my previous post I conclude that Org babel is just perfect for my use case. Well, as a beginner of Org babel I am not yet there completely and would like to ask for help on the source block header: -------------------------------------------- * Org babel function for Google Maps browser #+NAME: gmb #+HEADER: :var ty="m" spn=0.2 #+HEADER: :var geo_var=(or (org-entry-get nil "geo") "4.56,7.89") #+BEGIN_SRC emacs-lisp :results silent (browse-url (concat "http://maps.google.ch/maps?t=" ty "&spn=" (number-to-string spn) "," (number-to-string spn) "&ll=" geo_var "&q=" geo_var)) #+END_SRC * example of a geo location, realistic to try out :PROPERTIES: :geo: 4.56,7.89 :END: - call_gmb() - interactively (type C-c on "call_gmb") visualize the current geo location on Google Maps with a marker and as "map" in the browser - call_gmb(ty="k", spn=0.002) - visualize the same geo location on Google Maps with a marker, as "satellite image" and with a certain scale suitable for this specific geo location and view type * another geo location :PROPERTIES: :geo: 4.44,5.55 :END: - call_gmb(ty="p") - visualize another geo location as "terrain" -------------------------------------------- The issue is that org-entry-get returns nil instead of the value of the item property :geo:, therefore my "demo workaround" with the "or" to show the principle of "gmb". How to resolve this properly? Isn't there something like "#+HEADER: :var geo_var=:geo:" to copy the value of the item property :geo: to the babel variable unless specified by the caller? Not sure yet how to support export of such geo locations to a GPS track... That would probably be "simply" all item properties :geo: with the item's name and nothing else. Probably quite a boring exercise of writing a new exporter backend for someone who would know how to do it... Btw. I re-found the Org mode mailing list thread [2010-06-29 Tue] "Getting a Google Maps' map for an entry" http://thread.gmane.org/gmane.emacs.orgmode/26797 by Julien Danjou, currently to be found at http://julien.danjou.info/projects/emacs-packages#google-maps It can also be used as a backend to visualize a geo location and demonstrates the usage of the interesting Google Maps Static Maps API that converts a Google Maps URL to an image: https://developers.google.com/maps/documentation/staticmaps/#quick_example Michael