Skip to content

benedikt/maptastic

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

maptastic

The maptastic plugin for Ruby on Rails provides simple and unobtrusive helper methods and javascript libraries to integrate maps in web applications.

Requirements

Maptastic currently only works with Google Maps and Prototype. This might change in the future but for now that’s how it is.

Install

To install the maptastic gem, simply add it to your Gemfile:

gem 'maptastic'

In order to get the latest development version of maptastic:

gem 'maptastic', :git => 'git://github.com/benedikt/maptastic.git'

and run

bundle install

Afterwards you can run the generator to get the necessary files installed into your application

rails generate maptastic:install

To include the required javascripts put these two lines in your application.html.erb

<%= maptastic_provider_tag %>
<%= javascript_include_tag 'maptastic' %>

To finalize the installation please set your defaults in config/initializers/maptastic.rb

Configuration

To configure maptastic to your needs edit the config/initializers/maptastic.rb file.

Usage

Read the API documentation at benedikt.github.com/maptastic/doc

Examples (without markers):

<%= maptastic :center => [37.4419, -122.1419] %>
<%= maptastic :center => @poi %> # @poi.latitude and @poi.longitude are used

Examples (with markers):

<%= maptastic @poi %> # Simple marker without info window
<%= maptastic @pois do |poi| %>
  Generates a marker with info window (bubble). Uses @poi.latitude and @poi.longitude
  to position the marker.
  <%= poi.name %>
<% end %>

Available options:

<%= maptastic :center => [37.4419, -122.1419], :zoom => 10; :controls => true %>

Copyright © 2010 Benedikt Deicke. See LICENSE for details.

About

Simple and unobtrusive map integration plugin for Ruby on Rails

Resources

License

Stars

Watchers

Forks

Packages