Posted By

deschism on 03/16/10


Tagged

google rails map ym4r


Versions (?)

Custom YM4R Google Map Marker


 / Published in: Rails
 

URL: http://www.postal-code.com/binarycode/2007/11/28/google-map-markers-in-ym4rgm/

  1. map = GMap.new( Constants::GM_DIV_ID, Constants::GM_NAME )
  2.  
  3. # Define the start and end icons
  4. 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")
  5. 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" )
  6.  
  7. icon_start = Variable.new("icon_start"); icon_stop = Variable.new("icon_stop")
  8.  
  9. if respond_to?( "start_lat" ) && respond_to?( "start_long" )
  10. map.center_zoom_init( [start_lat, start_long], Constants::GM_ZOOM )
  11. map.overlay_init( GMarker.new( [start_lat, start_long], { :icon => icon_start, :title => name + " start", :info_window => "start" } ) )
  12. end
  13.  
  14. if respond_to?( "end_lat" ) && respond_to?( "end_long" )
  15. map.overlay_init( GMarker.new( [end_lat, end_long], { :icon => icon_stop, :title => name + " end", :info_window => "end" } ) )
  16. end

Report this snippet  

You need to login to post a comment.