emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Michael Brand <michael.ch.brand@gmail.com>
To: Org Mode <emacs-orgmode@gnu.org>
Cc: Julien Danjou <julien@danjou.info>,
	Christian Moe <mail@christianmoe.com>
Subject: Re: link abbreviation with multiple params, e. g. for geo locations
Date: Mon, 6 May 2013 20:42:54 +0200	[thread overview]
Message-ID: <CALn3zojeHoYedWMt_g0u+wis+FU4FXZsbsrszpqoSfBd_x7tUw@mail.gmail.com> (raw)
In-Reply-To: <m28v3sfuz1.fsf@uio.no>

On Mon, May 6, 2013 at 9:06 AM, Christian Moe <mail@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

  reply	other threads:[~2013-05-06 18:42 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-05 15:06 link abbreviation with multiple params, e. g. for geo locations Michael Brand
2013-05-06  7:06 ` Christian Moe
2013-05-06 18:42   ` Michael Brand [this message]
2013-05-06 22:29     ` Christian Moe
  -- strict thread matches above, loose matches on Subject: below --
2013-05-22 17:03 Michael Brand
2013-05-29 16:14 ` Michael Brand
2013-06-05 17:19   ` Michael Brand
2013-06-06 17:01 ` Eric Schulte
2013-06-07 14:53   ` Michael Brand
2013-06-07 15:18     ` Eric Schulte
2013-06-07 19:16       ` Michael Brand
2013-06-07 19:54         ` Vitalie Spinu
2013-06-08 18:05           ` Eric Schulte
2013-06-08 18:52             ` Vitalie Spinu
2013-06-08 19:21               ` Eric Schulte
2013-06-14 17:54                 ` Michael Brand
2013-06-14 18:18                   ` Eric Schulte
2013-06-14 20:13                     ` Michael Brand
2013-06-19  9:39                       ` Michael Brand
2013-06-07 20:10         ` Achim Gratz
2013-06-08 18:03         ` Eric Schulte
2013-06-09  7:56           ` Michael Brand
2013-06-09  8:07             ` Michael Brand
2013-06-09 19:18             ` Eric Schulte
2013-06-09 20:32               ` Michael Brand
2013-06-11 13:12                 ` Eric Schulte

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CALn3zojeHoYedWMt_g0u+wis+FU4FXZsbsrszpqoSfBd_x7tUw@mail.gmail.com \
    --to=michael.ch.brand@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=julien@danjou.info \
    --cc=mail@christianmoe.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).