emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Getting a Google Maps' map for an entry
@ 2010-06-29  8:42 Julien Danjou
  2010-06-29  9:09 ` Thierry Volpiatto
                   ` (4 more replies)
  0 siblings, 5 replies; 12+ messages in thread
From: Julien Danjou @ 2010-06-29  8:42 UTC (permalink / raw)
  To: emacs-orgmode


[-- Attachment #1.1: Type: text/plain, Size: 556 bytes --]

Hi there,

I've recently wrote a Google Maps extension for Emacs[1].

Therefore, I've extended org-mode to display a Google Maps' map for an
event location. The extension, which is very simple, is available
here[2] and I wanted you to know about it.

I'd be glad to have feedback. patches or ideas. ;)

Happy hacking.

[1]  http://julien.danjou.info/google-maps-el.html

[2]  http://git.naquadah.org/?p=~jd/jd-el.git;a=blob;f=org-location-google-maps.el;hb=HEAD

-- 
Julien Danjou
// ᐰ <julien@danjou.info>   http://julien.danjou.info

[-- Attachment #1.2: Type: application/pgp-signature, Size: 197 bytes --]

[-- Attachment #2: Type: text/plain, Size: 201 bytes --]

_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Getting a Google Maps' map for an entry
  2010-06-29  8:42 Getting a Google Maps' map for an entry Julien Danjou
@ 2010-06-29  9:09 ` Thierry Volpiatto
  2010-06-29  9:14 ` Giovanni Ridolfi
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 12+ messages in thread
From: Thierry Volpiatto @ 2010-06-29  9:09 UTC (permalink / raw)
  To: emacs-orgmode

Julien Danjou <julien@danjou.info> writes:

> Hi there,
>
> I've recently wrote a Google Maps extension for Emacs[1].
>
> Therefore, I've extended org-mode to display a Google Maps' map for an
> event location. The extension, which is very simple, is available
> here[2] and I wanted you to know about it.
>
> I'd be glad to have feedback. patches or ideas. ;)

Just have a quick try, work very well, thanks for this ;-).

-- 
Thierry Volpiatto
Gpg key: http://pgp.mit.edu/

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Getting a Google Maps' map for an entry
  2010-06-29  8:42 Getting a Google Maps' map for an entry Julien Danjou
  2010-06-29  9:09 ` Thierry Volpiatto
@ 2010-06-29  9:14 ` Giovanni Ridolfi
  2010-06-29 12:25 ` Memnon Anon
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 12+ messages in thread
From: Giovanni Ridolfi @ 2010-06-29  9:14 UTC (permalink / raw)
  To: Julien Danjou; +Cc: emacs-orgmode

Julien Danjou <julien@danjou.info> writes:

> I'd be glad to have feedback. patches or ideas. ;)

Julien, this is really nice, 

but... the image is not displayed in the 'Map' buffer.

'bug' report follows.
cheers,
Giovanni
-----------bug report-----------
Org-version   6.34trans
Emacs version GNU Emacs 23.2.1 (i386-mingw-nt5.1.2600) of 2010-05-08 on
              G41R2F1
OS            Windows XP SP 2

1. I downloaded the  4 +1 files

    google-maps-base.el
    google-maps-geocode.el
    google-maps-static.el
    google-maps.el

    org-location-google-maps.el

    from the web interface of your git repo.

2. I loaded the files with 
   M-x load-file $name-file

3. I wrote the property drawer in a org-file:
   :PROPERTIES:
   :LOCATION: Bologna Piazza Maggiore
   :END:

4. I C-c M-l on the word :LOCATION:

5. google was contacted...
6. Then: a "Map" buffer was opened, but it with nothing in it.

In the *Message* buffer I have two lines: 

Contacting host: maps.google.com:80
Reading [image/png]... 61k of 61k (100%)

I have a question: where is downloaded the .png image?
I couldn't find it in my "home".

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Getting a Google Maps' map for an entry
  2010-06-29  8:42 Getting a Google Maps' map for an entry Julien Danjou
  2010-06-29  9:09 ` Thierry Volpiatto
  2010-06-29  9:14 ` Giovanni Ridolfi
@ 2010-06-29 12:25 ` Memnon Anon
  2010-06-29 15:45   ` Julien Danjou
  2010-06-29 13:12 ` Sebastian Rose
  2010-07-01  9:00 ` d.tchin
  4 siblings, 1 reply; 12+ messages in thread
From: Memnon Anon @ 2010-06-29 12:25 UTC (permalink / raw)
  To: Julien Danjou; +Cc: emacs-orgmode

Hi,

cool stuff :)!

Julien Danjou <julien@danjou.info> writes:

> I'd be glad to have feedback. patches or ideas. ;)

I found a minor problem:

* Summary 
  Zooming on map fails if not 'initialized' with z

* Steps to reproduce
  - `M-x google-maps'
  - Location: `Statue of Liberty New York'
    Buffer Google-Maps is created, Statue of Liberty is displayed.
  - Press `+'
  - Message: `Current zoom level is unknown, cannot zoom in.'
  - Set a level with z: `M-1 M-5 z'
  - Zooms to level 15, `+' and `-' work as expected.

* System
  - GNU Emacs 24.0.50.1 (i486-pc-linux-gnu, GTK+ Version 2.20.1) of
        2010-06-19 on elegiac, modified by Debian
  -  git show google-maps.el
     commit d4f4916b5c9bb37025e86fef079292bf1604cfb5
     Author: Joseph Gay <gilleylen@gmail.com>
     Date:   Mon Jun 28 15:44:13 2010 -0500

It would be nice the initial zoom level of a map would be set right at
the beginning.

Memnon

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Getting a Google Maps' map for an entry
  2010-06-29  8:42 Getting a Google Maps' map for an entry Julien Danjou
                   ` (2 preceding siblings ...)
  2010-06-29 12:25 ` Memnon Anon
@ 2010-06-29 13:12 ` Sebastian Rose
  2010-06-29 13:29   ` Sebastian Rose
  2010-07-01  9:00 ` d.tchin
  4 siblings, 1 reply; 12+ messages in thread
From: Sebastian Rose @ 2010-06-29 13:12 UTC (permalink / raw)
  To: Julien Danjou; +Cc: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 781 bytes --]

Julien Danjou <julien@danjou.info> writes:
> Hi there,
>
> I've recently wrote a Google Maps extension for Emacs[1].
>
> Therefore, I've extended org-mode to display a Google Maps' map for an
> event location. The extension, which is very simple, is available
> here[2] and I wanted you to know about it.
>
> I'd be glad to have feedback. patches or ideas. ;)
>
> Happy hacking.
>
> [1]  http://julien.danjou.info/google-maps-el.html
>
> [2]  http://git.naquadah.org/?p=~jd/jd-el.git;a=blob;f=org-location-google-maps.el;hb=HEAD

Wow - works pefect on emacs 24!


'Current zoom level is unknown'

I guess `google-maps-static-default-zoom' is not set (possible patch
appended).


Thanks for sharing :)

We where talking about GEO locations and org-mode recently:




   Sebastian



[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: static.default-zoom-not-set.patch --]
[-- Type: text/x-diff, Size: 568 bytes --]

diff --git a/google-maps-static.el b/google-maps-static.el
index 644408d..98d9ac8 100644
--- a/google-maps-static.el
+++ b/google-maps-static.el
@@ -332,7 +332,7 @@ PLIST can contains this properties:
   "Zoom a Google map in."
   (interactive)
   (unless (plist-member google-maps-static-params :zoom)
-    (error "Current zoom level is unknown, cannot zoom in."))
+    (plist-set google-maps-static-params :zoom google-maps-static-default-zoom))
   (google-maps-static-zoom (1+ (plist-get google-maps-static-params :zoom))))
 
 (defun google-maps-static-zoom-out ()

[-- Attachment #3: Type: text/plain, Size: 201 bytes --]

_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: Getting a Google Maps' map for an entry
  2010-06-29 13:12 ` Sebastian Rose
@ 2010-06-29 13:29   ` Sebastian Rose
  0 siblings, 0 replies; 12+ messages in thread
From: Sebastian Rose @ 2010-06-29 13:29 UTC (permalink / raw)
  To: Julien Danjou; +Cc: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 1555 bytes --]

Sebastian Rose <sebastian_rose@gmx.de> writes:
> Julien Danjou <julien@danjou.info> writes:
>> Hi there,
>>
>> I've recently wrote a Google Maps extension for Emacs[1].
>>
>> Therefore, I've extended org-mode to display a Google Maps' map for an
>> event location. The extension, which is very simple, is available
>> here[2] and I wanted you to know about it.
>>
>> I'd be glad to have feedback. patches or ideas. ;)
>>
>> Happy hacking.
>>
>> [1]  http://julien.danjou.info/google-maps-el.html
>>
>> [2]  http://git.naquadah.org/?p=~jd/jd-el.git;a=blob;f=org-location-google-maps.el;hb=HEAD
>
> Wow - works pefect on emacs 24!
>
>
> 'Current zoom level is unknown'
>
> I guess `google-maps-static-default-zoom' is not set (possible patch
> appended).
>
>
> Thanks for sharing :)
>
> We where talking about GEO locations and org-mode recently:
>
>
>
>
>    Sebastian
>
>
>
> diff --git a/google-maps-static.el b/google-maps-static.el
> index 644408d..98d9ac8 100644
> --- a/google-maps-static.el
> +++ b/google-maps-static.el
> @@ -332,7 +332,7 @@ PLIST can contains this properties:
>    "Zoom a Google map in."
>    (interactive)
>    (unless (plist-member google-maps-static-params :zoom)
> -    (error "Current zoom level is unknown, cannot zoom in."))
> +    (plist-set google-maps-static-params :zoom google-maps-static-default-zoom))
>    (google-maps-static-zoom (1+ (plist-get google-maps-static-params :zoom))))
>  
>  (defun google-maps-static-zoom-out ()



Sorry, did not save before doing the `git diff'.
I like this patch better anyway:



[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: static.default-zoom-not-set-2.patch --]
[-- Type: text/x-diff, Size: 1411 bytes --]

diff --git a/google-maps-static.el b/google-maps-static.el
index 644408d..89c877a 100644
--- a/google-maps-static.el
+++ b/google-maps-static.el
@@ -328,12 +328,20 @@ PLIST can contains this properties:
                (max (min level google-maps-static-maximum-zoom) google-maps-static-minimum-zoom))
     (apply 'google-maps-static-show plist)))
 
-(defun google-maps-static-zoom-in ()
-  "Zoom a Google map in."
-  (interactive)
-  (unless (plist-member google-maps-static-params :zoom)
-    (error "Current zoom level is unknown, cannot zoom in."))
-  (google-maps-static-zoom (1+ (plist-get google-maps-static-params :zoom))))
+(defun google-maps-static-zoom-in (&optional arg)
+  "Zoom a Google map in.
+If the numeric prefix argument ARG is set, zoom in this much levels."
+  (interactive "p")
+  (let* ((arg (if (> 1 arg) 1 arg))
+         (current (or (plist-get google-maps-static-params :zoom)
+                      google-maps-static-default-zoom))
+         (next (if (and (<= (+ arg current) google-maps-static-maximum-zoom)
+                        (>= (+ arg current) google-maps-static-minimum-zoom))
+                   (+ arg current)
+                 google-maps-static-maximum-zoom)))
+    (setq google-maps-static-params
+          (plist-put google-maps-static-params :zoom next))
+  (google-maps-static-zoom next)))
 
 (defun google-maps-static-zoom-out ()
   "Zoom a Google map out."

[-- Attachment #3: Type: text/plain, Size: 13 bytes --]



Sebastian


[-- Attachment #4: Type: text/plain, Size: 201 bytes --]

_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: Getting a Google Maps' map for an entry
  2010-06-29 12:25 ` Memnon Anon
@ 2010-06-29 15:45   ` Julien Danjou
  2010-06-29 16:13     ` Thierry Volpiatto
  2010-06-30  5:28     ` Thierry Volpiatto
  0 siblings, 2 replies; 12+ messages in thread
From: Julien Danjou @ 2010-06-29 15:45 UTC (permalink / raw)
  To: Memnon Anon; +Cc: emacs-orgmode


[-- Attachment #1.1: Type: text/plain, Size: 465 bytes --]

On Tue, Jun 29 2010, Memnon Anon wrote:

> It would be nice the initial zoom level of a map would be set right at
> the beginning.

The problem is that this is not possible. The zoom level, if not
specified, is determined automatically by Google Maps, and we have no
clue about its value.

Therefore you need to press 'w' (with an eventual prefix) to set a first
zoom level.

-- 
Julien Danjou
// ᐰ <julien@danjou.info>   http://julien.danjou.info

[-- Attachment #1.2: Type: application/pgp-signature, Size: 197 bytes --]

[-- Attachment #2: Type: text/plain, Size: 201 bytes --]

_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Getting a Google Maps' map for an entry
  2010-06-29 15:45   ` Julien Danjou
@ 2010-06-29 16:13     ` Thierry Volpiatto
  2010-06-30  5:34       ` Julien Danjou
  2010-06-30  5:28     ` Thierry Volpiatto
  1 sibling, 1 reply; 12+ messages in thread
From: Thierry Volpiatto @ 2010-06-29 16:13 UTC (permalink / raw)
  To: emacs-orgmode

Julien Danjou <julien@danjou.info> writes:

> On Tue, Jun 29 2010, Memnon Anon wrote:
>
>> It would be nice the initial zoom level of a map would be set right at
>> the beginning.
>
> The problem is that this is not possible. The zoom level, if not
> specified, is determined automatically by Google Maps, and we have no
> clue about its value.
>
> Therefore you need to press 'w' (with an eventual prefix) to set a first
> zoom level.

You mean 'z' maybe?
I bind google-maps in addressbook-bookmark.el, that allow to jump on
gmap from a contact in addressbook (C-c g m).
addressbook is part of bookmark-extensions:
http://mercurial.intuxication.org/hg/emacs-bookmark-extension
 
-- 
Thierry Volpiatto
Gpg key: http://pgp.mit.edu/

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Getting a Google Maps' map for an entry
  2010-06-29 15:45   ` Julien Danjou
  2010-06-29 16:13     ` Thierry Volpiatto
@ 2010-06-30  5:28     ` Thierry Volpiatto
  1 sibling, 0 replies; 12+ messages in thread
From: Thierry Volpiatto @ 2010-06-30  5:28 UTC (permalink / raw)
  To: emacs-orgmode

Julien Danjou <julien@danjou.info> writes:

> On Tue, Jun 29 2010, Memnon Anon wrote:
>
>> It would be nice the initial zoom level of a map would be set right at
>> the beginning.
>
> The problem is that this is not possible. The zoom level, if not
> specified, is determined automatically by Google Maps, and we have no
> clue about its value.
>
> Therefore you need to press 'w' (with an eventual prefix) to set a first
> zoom level.

Specifying zoom level at startup seem to fix the problem:

,----
| (defun google-maps (location &optional no-geocoding)
|   "Run Google Maps on LOCATION.
| If NO-GEOCODING is t, then does not try to geocode the address
| and do not ask the user for a more precise location."
|   (interactive
|    (list
|     (if (use-region-p)
| 	(buffer-substring-no-properties
|          (region-beginning) (region-end))
|       (read-from-minibuffer  "Location: "
|                              nil nil nil nil
|                              (replace-regexp-in-string
|                               "\n" " "
|                               (or (thing-at-point 'sentence) ""))))))
|   (let ((location (if no-geocoding
|                       location
|                     (google-maps-geocode-location location))))
|     (google-maps-static-show :zoom google-maps-static-default-zoom
|                              :markers `(((,location))))))
`----

I use 10 as default value for `google-maps-static-default-zoom'.

-- 
Thierry Volpiatto
Gpg key: http://pgp.mit.edu/

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Re: Getting a Google Maps' map for an entry
  2010-06-29 16:13     ` Thierry Volpiatto
@ 2010-06-30  5:34       ` Julien Danjou
  0 siblings, 0 replies; 12+ messages in thread
From: Julien Danjou @ 2010-06-30  5:34 UTC (permalink / raw)
  To: Thierry Volpiatto; +Cc: emacs-orgmode


[-- Attachment #1.1: Type: text/plain, Size: 177 bytes --]

On Tue, Jun 29 2010, Thierry Volpiatto wrote:

> You mean 'z' maybe?

Yes, sorry, I meant z.

-- 
Julien Danjou
// ᐰ <julien@danjou.info>   http://julien.danjou.info

[-- Attachment #1.2: Type: application/pgp-signature, Size: 197 bytes --]

[-- Attachment #2: Type: text/plain, Size: 201 bytes --]

_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Getting a Google Maps' map for an entry
  2010-06-29  8:42 Getting a Google Maps' map for an entry Julien Danjou
                   ` (3 preceding siblings ...)
  2010-06-29 13:12 ` Sebastian Rose
@ 2010-07-01  9:00 ` d.tchin
  2010-07-02 11:56   ` d.tchin
  4 siblings, 1 reply; 12+ messages in thread
From: d.tchin @ 2010-07-01  9:00 UTC (permalink / raw)
  To: emacs-orgmode

Julien Danjou <julien <at> danjou.info> writes:

> 
> Hi there,
> 
> I've recently wrote a Google Maps extension for Emacs[1].
> 
> Therefore, I've extended org-mode to display a Google Maps' map for an
> event location. The extension, which is very simple, is available
> here[2] and I wanted you to know about it.
> 
> I'd be glad to have feedback. patches or ideas. ;)
> 
> Happy hacking.
> 
> [1]  http://julien.danjou.info/google-maps-el.html
> 
> [2]  http://git.naquadah.org/?p=~jd/jd-el.git;a=blob;f=org-location-google-
maps.el;hb=HEAD
> 


Dear Julien

I tried to use Google Maps extension. When I tried to load it, I found out 
that json.el was required. It seems that this package is included in "recent" 
emacs version (?).  My version is GNU Emacs 22.3.1 (i386-mingw-nt5.1.2600) of 
2008-09-06. I loaded it but then I have another error telling that the function
use-region-p doesn't exist. It seems that this function appears with emacs 23.
So this mail just to tell that it seems necessary to have at emacs 23 
to make this function work.

Best regards

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: Getting a Google Maps' map for an entry
  2010-07-01  9:00 ` d.tchin
@ 2010-07-02 11:56   ` d.tchin
  0 siblings, 0 replies; 12+ messages in thread
From: d.tchin @ 2010-07-02 11:56 UTC (permalink / raw)
  To: emacs-orgmode

 <d.tchin> writes:

> 
> Julien Danjou <julien <at> danjou.info> writes:
> 
> > 
> > Hi there,
> > 
> > I've recently wrote a Google Maps extension for Emacs[1].
> > 
> > Therefore, I've extended org-mode to display a Google Maps' map for an
> > event location. The extension, which is very simple, is available
> > here[2] and I wanted you to know about it.
> > 
> > I'd be glad to have feedback. patches or ideas. ;)
> > 
> > Happy hacking.
> > 
> > [1]  http://julien.danjou.info/google-maps-el.html
> > 
> > [2]  http://git.naquadah.org/?p=~jd/jd-el.git;a=blob;f=org-location-google-
> maps.el;hb=HEAD
> > 
> 
> Dear Julien
> 
> I tried to use Google Maps extension. When I tried to load it, I found out 
> that json.el was required. It seems that this package is included 
in "recent" 
> emacs version (?).  My version is GNU Emacs 22.3.1 (i386-mingw-nt5.1.2600) 
of 
> 2008-09-06. I loaded it but then I have another error telling that the 
function
> use-region-p doesn't exist. It seems that this function appears with emacs 
23.
> So this mail just to tell that it seems necessary to have at emacs 23 
> to make this function work.

Just one comment following previous mail.
Just tried with emacs 23.2. It works very well on this version and it is 
really great.

The bad thing is that this version of emacs is quite slow on Windows system. 
As far I understood it seems to be related to font handling. There is a lot of 
lag, the system freeze. 

So sadly I have to return to release 22.3.1 which is more robust.


d.tchin

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2010-07-02 11:56 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-06-29  8:42 Getting a Google Maps' map for an entry Julien Danjou
2010-06-29  9:09 ` Thierry Volpiatto
2010-06-29  9:14 ` Giovanni Ridolfi
2010-06-29 12:25 ` Memnon Anon
2010-06-29 15:45   ` Julien Danjou
2010-06-29 16:13     ` Thierry Volpiatto
2010-06-30  5:34       ` Julien Danjou
2010-06-30  5:28     ` Thierry Volpiatto
2010-06-29 13:12 ` Sebastian Rose
2010-06-29 13:29   ` Sebastian Rose
2010-07-01  9:00 ` d.tchin
2010-07-02 11:56   ` d.tchin

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).