README
1NAME
2 HTML::GoogleMaps - a simple wrapper around the Google Maps API
3
4SYNOPSIS
5 $map = HTML::GoogleMaps->new(key => $map_key,
6 db => $geo_coder_us_db);
7 $map->center(point => "1810 Melrose St, Madison, WI");
8 $map->add_marker(point => "1210 W Dayton St, Madison, WI");
9
10 my ($head, $map_div, $map_script) = $map->render;
11
12NOTE
13 This version is not API compatable with HTML::GoogleMaps versions 1 and
14 2. The render method now returns three values instead of two.
15
16DESCRIPTION
17 HTML::GoogleMaps provides a simple wrapper around the Google Maps API.
18 It allows you to easily create maps with markers, polylines and
19 information windows. If you have Geo::Coder::US installed, it will be
20 able to do basic geocoding for US addresses.
21
22CONSTRUCTOR
23 $map = HTML::GoogleMaps->new(key => $map_key);
24 Creates a new HTML::GoogleMaps object. Takes a hash of options. The
25 only required option is *key*, which is your Google Maps API key.
26 You can get a key at http://maps.google.com/apis/maps/signup.html .
27 Other valid options are:
28
29 db => Geo::Coder::US database
30 If given, the add_marker and add_polyline methods will be able
31 to map US addresses, as well as longitude/latitude pairs.
32
33 height => height in pixels
34 width => width in pixels
35
36METHODS
37 $map->center($point)
38 Center the map at a given point.
39
40 $map->zoom($level)
41 Set the zoom level
42
43 $map->controls($control1, $control2)
44 Enable the given controls. Valid controls are: large_map_control,
45 small_map_control, small_zoom_control and map_type_control.
46
47 $map->dragging($enable)
48 Enable or disable dragging.
49
50 $map->info_window($enable)
51 Enable or disable info windows.
52
53 $map->map_type($type)
54 Set the map type. Either map_type or satellite_type.
55
56 $map->add_icon(name => $icon_name, image => $image_url, shadow =>
57 $shadow_url, image_size => [ $width, $height ], shadow_size => [ $width,
58 $height ]);
59 Adds a new icon, which can later be used by add_marker. Optional
60 args include icon_anchor and info_window_anchor.
61
62 $map->add_marker(point => $point, html => $info_window_html)
63 Add a marker to the map at the given point. If html is specified,
64 add a popup info window as well. icon can be used to switch to
65 either a user defined icon (via the name) or a standard google
66 letter icon (A-J).
67
68 $map->add_polyline(points => [ $point1, $point2 ])
69 Add a polyline that connects the list of points. Other options
70 include color (any valid HTML color), weight (line width in pixels)
71 and opacity (between 0 and 1).
72
73 $map->render
74 Renders the map and returns a two element list. The first element
75 needs to be placed in the head section of your HTML document. The
76 second in the body where you want the map to appear.
77
78ONLINE EXAMPLE
79 <http://www.cs.wisc.edu/~nmueller/fsbo_open_houses.pl>
80
81SEE ALSO
82 <http://maps.google.com/apis/maps/documentation> <http://geocoder.us>
83
84AUTHORS
85 Nate Mueller <nate@cs.wisc.edu>
86
87