https://github.com/rossta/map_ready
A Rails plugin to convert models into map ready marker objects. Includes support for marker clustering and offsetting. Requires the geokit and geokit-rails.
https://github.com/rossta/map_ready
Last synced: 10 months ago
JSON representation
A Rails plugin to convert models into map ready marker objects. Includes support for marker clustering and offsetting. Requires the geokit and geokit-rails.
- Host: GitHub
- URL: https://github.com/rossta/map_ready
- Owner: rossta
- License: mit
- Created: 2009-05-29T03:51:18.000Z (almost 17 years ago)
- Default Branch: master
- Last Pushed: 2011-01-04T20:06:50.000Z (over 15 years ago)
- Last Synced: 2025-07-14T11:42:52.512Z (10 months ago)
- Language: Ruby
- Homepage: http://www.weplay.com
- Size: 146 KB
- Stars: 11
- Watchers: 4
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README
- Changelog: History.txt
- License: MIT-LICENSE
Awesome Lists containing this project
README
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