# coyote: CGGOOGLEMAPWIDGET__DEFINE

- coyote/Graphics
- [Source code]

Description

      This 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 JPEG or PNG format) to be returned from
      Goggle 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 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.
      .. image:: cggooglemapwidget.png

Categories

      Graphics

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 = Obj_New('cgGoogleMapWidget', MARKERS=[marker1, marker2], MAPTYPE='Terrain')
          END

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

History

      Change History::
         Written, 25 June 2012. DWF.
         Set the RETAIN keyword on the draw widget for UNIX machines. 28 June 2012. DWF.
         Beefed up and changed error handling when failing to obtain a map from Google Maps. 28 June 2012. DWF.
         Added NoForwardFix keyword to call to cgMap to allow better drawing of markers. 29 June 2012. DWF.
         Added the ability to turn markers on or off with VisibleMarkers keyword and property. 29 June 2012. DWF.
         Added a WID keyword to the GetProperty method to all the user to obtain the Goggle Map
             window index number. 29 Aug 2012. DWF.
         Goggle appreciates lat/lon values to six decimal points, so now passing all of it. 19 Feb 2015. DWF.

Copyright

      Copyright (c) 2012, Fanning Software Consulting, Inc.
       is the initialization method of the cgGoogleMapWidget object.

Params

      class: out, optional, type=structure
         The object class definition as a structure. Occasionally, comes in handy.

Keywords

      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.
      draw: in, optional, type=boolean, default=0
          Set this keyword if you want to immediate retrieve and display a new map with the
          updated properties.
      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.
      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.
      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 GoogleMapMarker 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.
      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.
      zoomlevel: in, optional, type=integer, default=12
          The zoom level of the requested Google map. Should be an integer between 0 and 21.
      gs have changed. Update the map coordinate object.
       to update the image?
      purpose of this method is to make the draw widget window the current window.
      purpose of this method is to zoom into the map by
      easing the zoom factor.