Skip to content

rossta/map_ready

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MapReady
========

A Rails plugin to convert models into map ready marker objects. Includes support for marker clustering and offsetting. Requires the geokit and geokit-rails.

The plugin provides several strategies for building map marker objects from mappable ActiveRecord models. Currently, a mappable ActiveRecord model is one that "acts_as_mappable" as defined in the geokit-rails plugin (dependency). The strategies include:
 1. one-to-one conversion (simple), 
 2. grouping by proximity (clustered), 
 3. offsetting by location (offset).

Dependencies
============

Currently map_ready depends on the geokit gem and the geokit-rails plugin

geokit

- http://github.com/andre/geokit-gem/tree/master

geokit-rails

- http://github.com/andre/geokit-rails/tree/master


Example
=======

Setup

Say for your Rails app you're building a map of all the best burger joints in your area. To make your burger joints map ready:

1. Use geokit/geokit-rails to provide geolocations (lat, lng) and add 'acts_as_mappable' to the class definition.
2. Add 'acts_as_map_marker' to the class definition. This declaration provides the interface for the marker builders to translate your mappable class to map markers.

class BurgerJoint < ActiveRecord::Base
  acts_as_mappable
  acts_as_map_marker
end

Usage

Simple
  markers = MapReady::MarkerBuilder::Simple.new(burger_joints).create_markers

Clustered
  markers = MapReady::MarkerBuilder::Clusterable.new(burger_joints).create_markers

Offset
  markers = MapReady::MarkerBuilder::Offsetable.new(burger_joints).create_markers


Copyright (c) 2009 Ross Kaffenberger, released under the MIT license

About

A Rails plugin to convert models into map ready marker objects. Includes support for marker clustering and offsetting. Requires the geokit and geokit-rails.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages