Embedding Google maps

Embedding Google maps is simple.

Default

All parameters have defaults, so the simplest call is:

<%= gmap  %>

example

By longitude and latitude

Use longitude and latitude to define your location:

<pre><code><br /><%= gmap :lat => 37.32, :long => -122.02 %><br /></code></pre>

example

By Address

Use an address (similar to what you enter on maps.google.com):

<%= gmap :address => "100 Main Street, CA 95030" %>

example

Define Size of Map on Page

Define the size of the map on your wiki page, in pixels:

<%= gmap :address => "100 Main Street, CA 95030", :width => "500", :height => "300" %>

 

Zoom the map

The default zoom is 15 (street level).

<%= gmap :marker => false, :lat => 37.32, :long => -122.02, :zoom => 11 %>

example

Markers

By default, the map has a marker at the specified lat/long or address. The marker can be turned off by setting :marker => false - see previous example. In addition, other markers can be added to maps. In this case, the map has to be named using the :gmapid parameter. After that, multiple markers can be added by referring to the same :gmapid. If :content is defined, a click on the marker will open a window with the content.

<%= gmap :gmapid => 'mrkrmap',
       :lat => 37.32, :long => -122.02 %>

<%= gmarker :gmapid => 'mrkrmap',
       :lat => 37.318, :long => -122.023,
       :content => "Hello" %>

example

Boundaries

Boundaries can be added to a map using an array of long/lat pairs:

<%= gmap :gmapid => 'bdry', :width => 500, :height => 200,
         :lat => 37.319, :long => -122.017, :zoom => 12 %><br /><br />

<%= gline :gmapid => 'bdry',
          :line => [ [-122.0322, 37.3344],
                     [-122.0217,  37.3343],
                     [-121.9955, 37.3208],
                     [-121.9963,  37.3090],
                     [-122.0077, 37.3104],
                     [-122.0214, 37.3095],
                     [-122.0322, 37.3124],
                     [-122.0322, 37.3344] ] %>

example

 

Multimedia Maps

A map with icons, photos and videos that are embedded in pop-ups can be added like this (a couple of youtube videos):

<%= gmap :gmapid => 'videomap', :marker => false,
       :width => 700, :height => 400,
       :lat => 36.72, :long => -118.9, :zoom => 12 %>

<%= gmarker :gmapid => 'videomap',
       :lat => 36.7032012939453, :long => -118.797996520996,
       :icon => '/images/Video.png',
       :shadow => 'images/Shadow.png',
       :thumbnail => 'http://img.youtube.com/vi/qSyNLfSX2TQ/2.jpg',
       :content => '<h2>Weaver Lake</h2>' +
'<object width="280" height="230"><param name="movie" value="http://www.youtube.com/v/qSyNLfSX2TQ"></param><embed src="http://www.youtube.com/v/qSyNLfSX2TQ" type="application/x-shockwave-flash" width="280" height="230"></embed></object>' %>

example