I have created a Blog for VBA novice. it has Tips and miscellaneous collection.
Here my new blog link Chennai VBA . Hope VBA people have gain some knowledge from it.
Thanks & Regards,
Wednesday, February 13, 2008
Wednesday, December 6, 2006
Ruby on Rails :: Google Maps plugin
Install as a plugin! From your rails application root, run
Or, install from svn
script/plugin install -x svn://cartographer.rubyforge.org/
svn co svn://rubyforge.org//var/svn/cartographer/trunk
First you need to sign up for an API key
Then, put your API key into the vendor/plugins/cartographer/lib/keys.rb file.
Open up your layout template (if you're using one) and
insert this code into the HEAD section:
<%= gmaps_header %>
Now, in your controller* define your map and set up some markers.
@map = Cartographer::Map.new( :name => 'mymap', :width =>
300, :center => [-110,33], :debug => true)
@map.markers << Cartographer::Marker.new( :position =>
[-110,33], :info_window => 'Clicky clicky!!', :map => @map )
* Realistically this can also be in your view, but it's a bit naughty of you to consider bending MVC!
Finally, render the map in your view.
<%= @map.to_html >
If you view the source to this page, you'll see what the above lines of code look like in
the rendered code (below this point). You can remove the :debug => true if you don't want commenting (it will compress
the code a little, too)
Because Cartographer is a plugin, you need to be running rails 0.14.3 or up (1.0 is great..)
You can easily use the code in other ruby-based frameworks quite easily, because there's nothing
actually tied to Rails.
If you're using an old version of cartographer, or old version of rails, we strongly recommend
you upgrade; however, check out the subversion repository, because we've tagged the old version
for you old-schoolers.
We just underwent a complete changeover of code, so the API code still needs to catch up. Until then,
you're smart, you can more than likely understand what's going on from reading the plugin source.
source courtesy: Cartographer