Sers, Michael!

> erstelle gerade eine Webseite mit google maps. Die Geodaten hole ich  
> mir über das Plugin GeoKIT
> 
> Beim darstellen der Karte gibt es mehrere Plugins, welches könnt ihr  
> mir empfehlen?
> [..]

Hast du aussergewöhnliche Dinge, die du in den Maps darstellen willst? 
Ich wollte einfach nur die Map anzeigen, dafür braucht man keine
Plugins. Ich hab im Layout ein <%= @content_for_script %> im <head/>,
und in meiner View ein einfach:

<% content_for :script do -%>
    <script src="http://maps.google.com/maps?file=api&amp;v=2&amp;key=<%= 
GeoKit::Geocoders::google %>" type="text/javascript"></script>
    <script type="text/javascript">
      function initialize() {
        if (GBrowserIsCompatible()) {
          var map = new GMap2(document.getElementById("map_canvas"));
          var loc = new GLatLng(<%= @location.lat %>, <%= @location.lng %>)
          map.setCenter(loc, 13);
          map.addControl(new GSmallMapControl());
          map.addOverlay(new GMarker(loc));
        }
      }
    </script>
<% end -%>
<div id="map_canvas"></div>

Ich sollte das noch in einen Helper auslagern, wenn ich's mehrfach
verwende denke ich, kommt halt drauf an, was du machen willst, ..

Gruesse, Rainer
_______________________________________________
rubyonrails-ug mailing list
[email protected]
http://mailman.headflash.com/mailman/listinfo/rubyonrails-ug

Antwort per Email an