comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Google Static Maps in IDL
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Google Static Maps in IDL [message #80768] Wed, 11 July 2012 08:38 Go to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Folks,

As long as I am talking about updating your Coyote Library
distribution this morning, let me give you another reason
to do so.

I have built a pretty nifty MABEL lidar browser recently
that you can download from an SVN repository if you are
interested in this new photon counting lidar data.
Complete directions are available in the Wiki you will
find on the MABEL project page.

http://sourceforge.net/projects/mabelidl/

In addition to the zooming/panning capability that I
built into cgZPlot, I wanted the user to be able to
see the lidar track on a map. If the map showed the
topography of the location that would be a HUGE plus
for me. And, of course, I wanted to be able to annotate
the map with features that were pertinent to the lidar
flight.

To this end, I built a small object that exposes quite
a bit of the Google Static Map API:

https://developers.google.com/maps/documentation/staticmaps/

Static maps are actually images that come back from Google.
You can't interact with them in the same way you can with
a Google map in a web browser. There are definite limitations.
For example the image that returns can be no larger than
640x640 pixels. But, you can set the zoom level and the
type of map you want: terrain, satellite, roadmap, or hybrid.
You can also add Google markers to the map.

Displaying the image is straightforward, of course. The tricky
part was figuring out how to set up the map coordinates to be
able to navigate the map and annotate it myself. (The images
are returned in GIF, JPEG, or PNG formats, but NOT in the
more useful GeoTiff format. That can't really be an oversight!)

All this to say that is built a compound widget/object
named cgGoogleMapWidget to retrieve and work with these static
Google map images. I have added this to the most recent version
of the library.

I have put a picture of the MabelBrowser here so you can see
how the map can be used:

http://www.idlcoyote.com/misc/mabelbrowser.png

The window at the top allows me to zoom into and pan to
the relevant lidar location. The window at the bottom is
the cgGoogleMapWidget compound widget, shown here as a terrain
map. As you can see, buttons allow you to choose different
map and marker types to display on the map, and I have annotated
the map with box axes and grid lines. (I am displaying
user-defined markers, rather than Google markers on this map.)
Both the zoom/pan plot and the map can be saved as high-quality
raster and PostScript output should you want to make slides
of them, etc.

There is a delay when the map is updated, comparable to the
delay you would experience with function graphics, while I
go out to the Internet and get a new map from Google,
but it is not bad, and it allows me to center the map at
a location where I click, etc. If I click near a map marker,
it will update the zoom/pan plot to that marker location.

If you are just interested in the cgGoogleMapWidget program itself,
you can run the program to see where Coyote lives. If it is not
passed the identifier of a parent widget, it will create it's
own top-level base.

IDL> object = cgGoogleMapWidget()

You can find all the necessary programs in the latest version
of the Coyote Library:

http://www.idlcoyote.com/programs/zip_files/coyoteprograms.z ip

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
Re: Google Static Maps in IDL [message #80837 is a reply to message #80768] Thu, 12 July 2012 19:05 Go to previous message
natha is currently offline  natha
Messages: 482
Registered: October 2007
Senior Member
On Wednesday, July 11, 2012 11:38:42 AM UTC-4, David Fanning wrote:
> Folks,
>
> As long as I am talking about updating your Coyote Library
> distribution this morning, let me give you another reason
> to do so.
>
> I have built a pretty nifty MABEL lidar browser recently
> that you can download from an SVN repository if you are
> interested in this new photon counting lidar data.
> Complete directions are available in the Wiki you will
> find on the MABEL project page.
>
> http://sourceforge.net/projects/mabelidl/
>
> In addition to the zooming/panning capability that I
> built into cgZPlot, I wanted the user to be able to
> see the lidar track on a map. If the map showed the
> topography of the location that would be a HUGE plus
> for me. And, of course, I wanted to be able to annotate
> the map with features that were pertinent to the lidar
> flight.
>
> To this end, I built a small object that exposes quite
> a bit of the Google Static Map API:
>
> https://developers.google.com/maps/documentation/staticmaps/
>
> Static maps are actually images that come back from Google.
> You can't interact with them in the same way you can with
> a Google map in a web browser. There are definite limitations.
> For example the image that returns can be no larger than
> 640x640 pixels. But, you can set the zoom level and the
> type of map you want: terrain, satellite, roadmap, or hybrid.
> You can also add Google markers to the map.
>
> Displaying the image is straightforward, of course. The tricky
> part was figuring out how to set up the map coordinates to be
> able to navigate the map and annotate it myself. (The images
> are returned in GIF, JPEG, or PNG formats, but NOT in the
> more useful GeoTiff format. That can't really be an oversight!)
>
> All this to say that is built a compound widget/object
> named cgGoogleMapWidget to retrieve and work with these static
> Google map images. I have added this to the most recent version
> of the library.
>
> I have put a picture of the MabelBrowser here so you can see
> how the map can be used:
>
> http://www.idlcoyote.com/misc/mabelbrowser.png
>
> The window at the top allows me to zoom into and pan to
> the relevant lidar location. The window at the bottom is
> the cgGoogleMapWidget compound widget, shown here as a terrain
> map. As you can see, buttons allow you to choose different
> map and marker types to display on the map, and I have annotated
> the map with box axes and grid lines. (I am displaying
> user-defined markers, rather than Google markers on this map.)
> Both the zoom/pan plot and the map can be saved as high-quality
> raster and PostScript output should you want to make slides
> of them, etc.
>
> There is a delay when the map is updated, comparable to the
> delay you would experience with function graphics, while I
> go out to the Internet and get a new map from Google,
> but it is not bad, and it allows me to center the map at
> a location where I click, etc. If I click near a map marker,
> it will update the zoom/pan plot to that marker location.
>
> If you are just interested in the cgGoogleMapWidget program itself,
> you can run the program to see where Coyote lives. If it is not
> passed the identifier of a parent widget, it will create it's
> own top-level base.
>
> IDL> object = cgGoogleMapWidget()
>
> You can find all the necessary programs in the latest version
> of the Coyote Library:
>
> http://www.idlcoyote.com/programs/zip_files/coyoteprograms.z ip
>
> Cheers,
>
> David
> --
> David Fanning, Ph.D.
> Fanning Software Consulting, Inc.
> Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
> Sepore ma de ni thui. ("Perhaps thou speakest truth.")
Re: Google Static Maps in IDL [message #80843 is a reply to message #80768] Thu, 12 July 2012 13:36 Go to previous message
Craig Markwardt is currently offline  Craig Markwardt
Messages: 1869
Registered: November 1996
Senior Member
On Thursday, July 12, 2012 2:16:57 PM UTC-4, Mike Galloy wrote:
> On 7/12/12 12:00 PM, Coyote wrote:
> > On Thursday, July 12, 2012 5:59:52 AM UTC-6, Fab wrote:
> >
> >> Great stuff David!
> >>
> >> It works perfectly on my machine and on my university network:
> >>
> >> { x86_64 linux unix linux 7.1.1 Aug 21 2009 64 64}
> >
> > The problem appears now to be related to an environment variable on Macs. I am trying to store the image that comes back from Google in a temporary directory located with the GetEnv command like this:
> >
> > tempdir = GetEnv('IDL_TMPDIR', /ENVIRONMENT)
> >
> > This directory either doesn't exist, or can't be written into, on this particular Mac. Can someone with a Mac help me understand what this directory might be?
> >
> > Thanks,
> >
> > David
> >
>
> For me on my Mac with IDL 8.1 and 8.2, both
>
> IDL> print, getenv('IDL_TMPDIR')
> /var/folders/j2/hhx4tc4d6wn13qkl4mj_dksr0000gz/T/
> IDL> print, filepath('', /tmp)
> /var/folders/j2/hhx4tc4d6wn13qkl4mj_dksr0000gz/T/
>
> yield the same thing and I can write to files in that directory.

Yep, same success here!
Craig
Re: Google Static Maps in IDL [message #80845 is a reply to message #80768] Thu, 12 July 2012 11:43 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Michael Galloy writes:

> For me on my Mac with IDL 8.1 and 8.2, both
>
> IDL> print, getenv('IDL_TMPDIR')
> /var/folders/j2/hhx4tc4d6wn13qkl4mj_dksr0000gz/T/
> IDL> print, filepath('', /tmp)
> /var/folders/j2/hhx4tc4d6wn13qkl4mj_dksr0000gz/T/
>
> yield the same thing and I can write to files in that directory.

This particular Mac was returning the name of
a directory that didn't exist. Once we created
it, all was well. Don't know, but I'm adding
a check for this now.

Cheers,

David



--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
Re: Google Static Maps in IDL [message #80846 is a reply to message #80768] Thu, 12 July 2012 11:16 Go to previous message
Michael Galloy is currently offline  Michael Galloy
Messages: 1114
Registered: April 2006
Senior Member
On 7/12/12 12:00 PM, Coyote wrote:
> On Thursday, July 12, 2012 5:59:52 AM UTC-6, Fab wrote:
>
>> Great stuff David!
>>
>> It works perfectly on my machine and on my university network:
>>
>> { x86_64 linux unix linux 7.1.1 Aug 21 2009 64 64}
>
> The problem appears now to be related to an environment variable on Macs. I am trying to store the image that comes back from Google in a temporary directory located with the GetEnv command like this:
>
> tempdir = GetEnv('IDL_TMPDIR', /ENVIRONMENT)
>
> This directory either doesn't exist, or can't be written into, on this particular Mac. Can someone with a Mac help me understand what this directory might be?
>
> Thanks,
>
> David
>

For me on my Mac with IDL 8.1 and 8.2, both

IDL> print, getenv('IDL_TMPDIR')
/var/folders/j2/hhx4tc4d6wn13qkl4mj_dksr0000gz/T/
IDL> print, filepath('', /tmp)
/var/folders/j2/hhx4tc4d6wn13qkl4mj_dksr0000gz/T/

yield the same thing and I can write to files in that directory.

-Mike



--
Michael Galloy
www.michaelgalloy.com
Modern IDL: A Guide to IDL Programming (http://modernidl.idldev.com)
Research Mathematician
Tech-X Corporation
Re: Google Static Maps in IDL [message #80847 is a reply to message #80768] Thu, 12 July 2012 11:00 Go to previous message
DavidF[1] is currently offline  DavidF[1]
Messages: 94
Registered: April 2012
Member
On Thursday, July 12, 2012 5:59:52 AM UTC-6, Fab wrote:

> Great stuff David!
>
> It works perfectly on my machine and on my university network:
>
> { x86_64 linux unix linux 7.1.1 Aug 21 2009 64 64}

The problem appears now to be related to an environment variable on Macs. I am trying to store the image that comes back from Google in a temporary directory located with the GetEnv command like this:

tempdir = GetEnv('IDL_TMPDIR', /ENVIRONMENT)

This directory either doesn't exist, or can't be written into, on this particular Mac. Can someone with a Mac help me understand what this directory might be?

Thanks,

David
Re: Google Static Maps in IDL [message #80850 is a reply to message #80768] Thu, 12 July 2012 04:59 Go to previous message
Fabzi is currently offline  Fabzi
Messages: 305
Registered: July 2010
Senior Member
Great stuff David!

It works perfectly on my machine and on my university network:

{ x86_64 linux unix linux 7.1.1 Aug 21 2009 64 64}
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: compilation strangeness
Next Topic: Use of /APPEND keyword

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 11:42:29 PDT 2025

Total time taken to generate the page: 0.00500 seconds