GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages


Manual Reference Pages  -  HTML::GOOGLEMAPS (3)

.ds Aq ’

NAME

HTML::GoogleMaps - a simple wrapper around the Google Maps API

CONTENTS

SYNOPSIS



  use HTML::GoogleMaps

  $map = HTML::GoogleMaps->new(key => $map_key);
  $map->center("1810 Melrose St, Madison, WI");
  $map->add_marker(point => "1210 W Dayton St, Madison, WI");
  $map->add_marker(point => [ 51, 0 ] );   # Greenwich

  my ($head, $map_div) = $map->onload_render;



NOTE

This version is not API compatable with HTML::GoogleMaps versions 1 and 2. The render method now returns three values instead of two.

DESCRIPTION

HTML::GoogleMaps provides a simple wrapper around the Google Maps API. It allows you to easily create maps with markers, polylines and information windows. Thanks to Geo::Coder::Google you can now look up locations around the world without having to install a local database.

CONSTRUCTOR

$map = HTML::GoogleMaps->new(key => $map_key); Creates a new HTML::GoogleMaps object. Takes a hash of options. The only required option is key, which is your Google Maps API key. You can get a key at http://maps.google.com/apis/maps/signup.html . Other valid options are:
height => height (in pixels or using your own unit)
width => width (in pixels or using your own unit)
ua => UserAgent object used internally

METHODS

$map->center($point) Center the map at a given point.
$map->v2_zoom($level) Set the new zoom level (0 is corsest)
$map->controls($control1, $control2) Enable the given controls. Valid controls are: <B>large_map_controlB>, <B>small_map_controlB>, <B>small_zoom_controlB> and <B>map_type_controlB>.
$map->dragging($enable) Enable or disable dragging.
$map->info_window($enable) Enable or disable info windows.
$map->map_type($type) Set the map type. Either <B>normalB>, <B>satelliteB> or <B>hybridB>. The v1 API <B>map_typeB> or <B>satellite_typeB> still work, but may be dropped in a future version.
$map->map_id($id) Set the id of the map div
$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.
$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>htmlB> is specified, add a popup info window as well. <B>iconB> 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>htmlB> 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>noformatB> => 1 as well.

$map->add_polyline(points => [ $point1, $point2 ]) Add a polyline that connects the list of points. Other options include <B>colorB> (any valid HTML color), <B>weightB> (line width in pixels) and <B>opacityB> (between 0 and 1).
$map->render <B>DEPRECATED — please use onload_render intead, it will give you better javascript.B>

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.

$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()">



SEE ALSO

<http://www.google.com/apis/maps> <http://geocoder.us>

AUTHORS

Nate Mueller <nate@cs.wisc.edu>
Search for    or go to Top of page |  Section 3 |  Main Index


perl v5.20.3 HTML::GOOGLEMAPS (3) 2016-04-03

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.