Skip to content

Navigation Menu

Sign up

Display Everything!

apneadiving edited this page Mar 19, 2011 · 6 revisions

##Mix different kinds of data

To display several kind of data at the same time, simply add these to the hash.

<%= gmaps({
 "map_options" => { "type" => "SATELLITE", "center_longitude" => 180, "zoom" => 3},
 "markers" => { "data" => @json,
 # "options" => @markers_options 
 }, 
 "polylines" => { "data" => '[[
 {"longitude": -122.214897, "latitude": 37.772323},
				 {"longitude": -157.821856, "latitude": 21.291982},
				 {"longitude": 178.431, "latitude": -18.142599},
				 {"longitude": 153.027892, "latitude": -27.46758}
				 ],
 		 [
		 		 {"longitude": -120.214897, "latitude": 30.772323, "strokeColor": "#000", "strokeWeight" : 2 },
				 {"longitude": -10.821856, "latitude": 50.291982}
				 ]]', 
 # "options" => {"strokeColor"=> "#000", "strokeWeight" => 2}
 },
 "polygons" => { "data" => '[[
 				{"longitude": -80.190262, "latitude": 25.774252},
 				{"longitude": -66.118292, "latitude": 18.466465},
 			 {"longitude": -64.75737, "latitude": 32.321384}
 				]]', 
 #"options" => @polygons_options
 },
 "circles" => { "data" => '[
 {"longitude": -122.214897, "latitude": 37.772323, "radius": 1000000},
 {"longitude": 122.214897, "latitude": 37.772323, "radius": 1000000, "strokeColor": "#FF0000"}
 ]',
 #"options" => @circles_options
 },
 "direction" => { 
 "data" => { "from" => "toulon, france", "to" => "paris, france"} , 
 "options" => {"waypoints" => ["toulouse, france", "brest, france"], "travelMode" => "DRIVING", "display_panel" => true, "panel_id" => "instructions"}
 }
 })
%>

Clone this wiki locally

AltStyle によって変換されたページ (->オリジナル) /