HTML-GoogleMaps
view release on metacpan or search on metacpan
lib/HTML/GoogleMaps.pm view on Meta::CPAN
=item width => width (in pixels or using your own unit)
=back
=back
=head1 METHODS
=over 4
=item $map->center($point)
Center the map at a given point.
=item $map->v2_zoom($level)
Set the new zoom level (0 is corsest)
=item $map->controls($control1, $control2)
Enable the given controls. Valid controls are: B<large_map_control>,
B<small_map_control>, B<small_zoom_control> and B<map_type_control>.
=item $map->dragging($enable)
Enable or disable dragging.
=item $map->info_window($enable)
Enable or disable info windows.
=item $map->map_type($type)
Set the map type. Either B<normal>, B<satellite> or B<hybrid>. The
v1 API B<map_type> or B<satellite_type> still work, but may be dropped
in a future version.
=item $map->map_id($id)
Set the id of the map div
=item $map->add_icon(name => $icon_name,
image => $image_url,
shadow => $shadow_url,
icon_size => [ $width, $height ],
shadow_size => [ $width, $height ],
icon_anchor => [ $x, $y ],
info_window_anchor => [ $x, $y ]);
Adds a new icon, which can later be used by add_marker. All args
are required except for info_window_anchor.
=item $map->add_marker(point => $point, html => $info_window_html)
Add a marker to the map at the given point. A point can be a unique
place name, like an address, or a pair of coordinates passed in as
an arrayref: [ longituded, latitude ].
If B<html> is specified,
add a popup info window as well. B<icon> can be used to switch to
either a user defined icon (via the name) or a standard google letter
icon (A-J).
Any data given for B<html> is placed inside a 350px by 200px div to
make it fit nicely into the Google popup. To turn this behavior off
just pass B<noformat> => 1 as well.
=item $map->add_polyline(points => [ $point1, $point2 ])
Add a polyline that connects the list of points. Other options
include B<color> (any valid HTML color), B<weight> (line width in
pixels) and B<opacity> (between 0 and 1).
=item $map->render
B<DEPRECATED -- please use onload_render intead, it will give you
better javascript.>
Renders the map and returns a three element list. The first element
needs to be placed in the head section of your HTML document. The
second in the body where you want the map to appear. The third (the
Javascript that controls the map) needs to be placed in the body,
but outside any div or table that the map lies inside of.
=item $map->onload_render
Renders the map and returns a two element list. The first element
needs to be placed in the head section of your HTML document. The
second in the body where you want the map to appear. You will also
need to add a call to html_googlemaps_initialize() in your page's
onload handler. The easiest way to do this is adding it to the body
tag:
<body onload="html_googlemaps_initialize()">
=back
=head1 SEE ALSO
L<http://www.google.com/apis/maps>
L<http://geocoder.us>
=head1 AUTHORS
Nate Mueller <nate@cs.wisc.edu>
=cut
package HTML::GoogleMaps;
use strict;
use Geo::Coder::Google;
our $VERSION = 10;
sub new {
my ($class, %opts) = @_;
die "Need a map key? Go to http://www.google.com/apis/maps/signup.html\n"
unless $opts{key};
if ($opts{db}) {
require Geo::Coder::US;
Geo::Coder::US->set_db($opts{db});
}
( run in 3.079 seconds using v1.01-cache-2.11-cpan-364913b4093 )