From mboxrd@z Thu Jan 1 00:00:00 1970 From: Michael Brand Subject: Re: link abbreviation with multiple params, e. g. for geo locations Date: Mon, 6 May 2013 20:42:54 +0200 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Return-path: Received: from eggs.gnu.org ([208.118.235.92]:38267) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UZQNG-0001cD-Gp for emacs-orgmode@gnu.org; Mon, 06 May 2013 14:42:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UZQNE-0005tj-SF for emacs-orgmode@gnu.org; Mon, 06 May 2013 14:42:58 -0400 Received: from mail-la0-x236.google.com ([2a00:1450:4010:c03::236]:50783) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UZQNE-0005tU-Kg for emacs-orgmode@gnu.org; Mon, 06 May 2013 14:42:56 -0400 Received: by mail-la0-f54.google.com with SMTP id fd20so3618236lab.27 for ; Mon, 06 May 2013 11:42:54 -0700 (PDT) In-Reply-To: List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Org Mode Cc: Julien Danjou , Christian Moe On Mon, May 6, 2013 at 9:06 AM, Christian Moe 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