Map Layers plugin

Plugin details

MapLayers makes it easy to integrate a dynamic map in a Rails application. It can display map tiles and markers loaded from many different data sources. With MapLayers you can display and publish ActiveRecord models with geographic data.

Websitehttp://www.sourcepole.com/2008/3/23/maplayers-plugin-for-rails Repositoryhttp://www.sourcepole.ch/svn/plugins/map_layers/trunk Author Pirmin Kalberer Tags Maps, Geo, Google, yahoo LicenseMIT

Documentation

Install the plugin:
ruby script/plugin install http://www.sourcepole.ch/svn/plugins/map_layers/trunk

Create a controller and a view

./script/generate controller Map index



Add the map viewer initialization to the index action in the controller:

@map = MapLayers::Map.new("map") do |map, page|
  page << map.add_layer(MapLayers::GOOGLE)
  page << map.zoom_to_max_extent()
end



Add this to the head of your view:

<%= map_layers_includes :google => "ABQIAAAA3HdfrnxFAPWyY-aiJUxmqRTJQa0g3IQ9GZqIMmInSLzwtGDKaBQ0KYLwBEKSM7F9gCevcsIf6WPuIQ" %>



Put a map in the body your view:

div id="map" style="width: 512px; height: 256px;">

<%= @map.to_html %>



Test your basic map with http://localhost:3000/map

Further Documentation

There is currently no advanced documentation for this plugin.

New documentation

Edit plugin | Back in time (9 older versions) | Last edited by: pka, about 1 month ago