/ Published in: Rails
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
map = GMap.new( Constants::GM_DIV_ID, Constants::GM_NAME ) # Define the start and end icons map.icon_global_init( GIcon.new( :image => "/images/google_maps/icong.png", :icon_size => GSize.new( 24,38 ), :icon_anchor => GPoint.new(12,38), :info_window_anchor => GPoint.new(9,2) ), "icon_start") map.icon_global_init( GIcon.new( :image => "/images/google_maps/iconr.png", :icon_size => GSize.new( 24,38 ), :icon_anchor => GPoint.new(12,38), :info_window_anchor => GPoint.new(9,2) ), "icon_stop" ) icon_start = Variable.new("icon_start"); icon_stop = Variable.new("icon_stop") if respond_to?( "start_lat" ) && respond_to?( "start_long" ) map.center_zoom_init( [start_lat, start_long], Constants::GM_ZOOM ) map.overlay_init( GMarker.new( [start_lat, start_long], { :icon => icon_start, :title => name + " start", :info_window => "start" } ) ) end if respond_to?( "end_lat" ) && respond_to?( "end_long" ) map.overlay_init( GMarker.new( [end_lat, end_long], { :icon => icon_stop, :title => name + " end", :info_window => "end" } ) ) end
URL: http://www.postal-code.com/binarycode/2007/11/28/google-map-markers-in-ym4rgm/