Coyote Graphics Map Projection Routines

Date: Fri Nov 29 13:44:27 2013

single page | use frames     summary     class     fields     routine details     file attributes

.\

cggooglemapwidget.pro


top cgGoogleMapWidget

Graphics, Widgets

result = cgGoogleMapWidget( [parent] [, /BOX_AXES] [, /BUTTON_EVENTS] [, CENTER_LATITUDE=float] [, CENTER_LONGITUDE=float] [, IMAGETYPE=string] [, /KEEP_IMAGE] [, EVENT_METHOD=string] [, EVENT_PRO=string] [, MAPTYPE=string] [, MARKERS=structure] [, /MOTION_EVENTS] [, TEMPDIR=string] [, /VISIBLEMARKERS] [, XSIZE=int] [, YSIZE=int] [, ZOOMLEVEL=integer])

This is the driver for the cgGoogleMapWidget object, which is a compound widget object that obtains a Google static map from Google Maps and displays it in the program's draw widget window. It can be used either as a stand-alone program or to create a map image in draw widget in a larger widget program.

This program implements a subset of the Google Static Map API, which can be found in more detail here: https://developers.google.com/maps/documentation/staticmaps/. The program works by building a URL for a map image. A connection to the Internet is required to then request a map image (in GIF, JPEG or PNG format) to be returned from Google Maps. The returned image is then read and loaded into a draw widget window of the right size for the returned map image. The default is to delete the image file that is created, but the user can also set keywords to retain the image that is downloaded from Google Maps. Users are able to control button and motion events in the resulting draw widget with their own event handler module. A cgMap coordinate object is created to establish a map reference coordinate system on top of the returned map image, allowing other map information to be drawn on top of the returned map image.

Return value

The return value is an instance of a cgGoogleMapWidget object.

Parameters

parent in optional type=long

The identifier of the parent widget of the draw widget that is going to be created by the program. If not provided, the program will create its own top-level base widget as the parent.

Keywords

BOX_AXES in optional type=boolean default=0

Set this keyword to draw box axes around the Google Map.

BUTTON_EVENTS in optional type=boolean default=0

Set this keyword to turn button events on for the draw widget in the program.

CENTER_LATITUDE in optional type=float default=40.60

The center latitude of the requested Google map. If not provided, the latitude of Fort Collins, Colorado, home of Coyote. Latitudes are only recognized to four decimals values of precision.

CENTER_LONGITUDE in optional type=float default=-105.10

The center longitude of the requested Google map. If not provided, the longitude of Fort Collins, Colorado, home of Coyote. Longitude are only recognized to four decimals values of precision.

IMAGETYPE in optional type=string default=png32

The type of image format the Google map should be returned in. The default is a 32-bit full color PNG file. The image types are given in the Google Static Map API documentation and are as follows: png or png8, png32, gif, jpg, and jpg-baseline.

KEEP_IMAGE in optional type=boolean default=0

Set this keyword if you wish to save the Google map as an image when the object is destroyed.

EVENT_METHOD in optional type=string

The name of the event handler method for the draw widget. If you use this keyword, you will also need to write this event handler module. It gets sent one positional parameter, the event structure created by the draw widget.

EVENT_PRO in optional type=string

The name of an external event handler procedure for the draw widget. The event handler procedure gets sent one positional parameter, the event structure created by the draw widget.

MAPTYPE in optional type=string default=terrain

Set this keyword to the type of map you wish to retrieve from Google Maps. The choices are listed in the Google Static Map API documentation and are: "roadmap", "terrain", "satellite", and "hybrid".

MARKERS in optional type=structure

A scalar or array of cgGoogleMapMarker structures. If present, the markers will be requested with the map from Google. The cgGoogleMapMarker structure is defined like this:

struct = { cgGOOGLEMAPMARKER, $ size: "", $ ; The marker size ("tiny", "small", "mid" or "normal") color: "", $ ; A color name as provided by cgColor. label: "", $ ; A single uppercase character label from the set {A-Z,0-9}. lats: Ptr_New(), $ ; A pointer to one or more latitude values. lons: Ptr_New() } ; A pointer to one or more longitude values.
Note that the user will be responsible for freeing the pointers in the MARKERS structure. This program will not do that.

MOTION_EVENTS in optional type=boolean default=0

Set this keyword to turn motion events on for the draw widget in the program.

TEMPDIR in optional type=string

The directory where the image containing the Google map is written. By default, it is obtained from the environment like this: tempdir = GetEnv('IDL_TMPDIR').

VISIBLEMARKERS in optional type=boolean default=1

Set this keyword to 0 to temporarily turn off the display of the markers. Normally, markers are drawn (if present), unless this flag is set to 0.

XSIZE in optional type=int default=600

The X size of the program's draw widget. A maximum of 690 if box axes are requested and a maximum of 640 if no box axes are requested. Box axes require a 25 pixel border and the maximum size of a Google Map is 640 pixels.

YSIZE in optional type=int default=600

The Y size of the program's draw widget. A maximum of 690 if box axes are requested and a maximum of 640 if no box axes are requested. Box axes require a 25 pixel border and the maximum size of a Google Map is 640 pixels.

ZOOMLEVEL in optional type=integer default=12

The zoom level of the requested Google map. Should be an integer between 0 and 21.

Examples

Used to put two markers on a map of Fort Collins, Colorado, in a stand-alone window:

PRO cgGoogleMapWidget_Test marker1 = {cgGOOGLEMAPMARKER, 'normal', 'dodger blue', 'A', Ptr_New(40.600), Ptr_New(-105.100)} marker2 = {cgGOOGLEMAPMARKER, 'normal', 'purple', 'B', Ptr_New(40.605), Ptr_New(-105.105)} googleObject = cgGoogleMapWidget(MARKERS=[marker1, marker2], MAPTYPE='Terrain') END

Author information

Author:

FANNING SOFTWARE CONSULTING:

David W. Fanning 1645 Sheely Drive Fort Collins, CO 80526 USA Phone: 970-221-0438 E-mail: david@idlcoyote.com Coyote's Guide to IDL Programming: http://www.idlcoyote.com

Copyright:

Copyright (c) 2012, Fanning Software Consulting, Inc.

History:

Change History:

Written, 25 June 2012. DWF.

File attributes

Modification date: Fri Jan 25 17:05:02 2013
Lines: 194
Docformat: rst rst