google_map 0.0.2 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,173 @@
1
+ # GoogleMap
2
+
3
+ A RubyGem that and makes generating google maps easy as pie.
4
+
5
+ INSTALL
6
+ -------
7
+
8
+ Run:
9
+ $ gem install google_map
10
+ $ bundle install
11
+
12
+ CONFIGURATION
13
+ -------------
14
+
15
+ Set your Google Maps API Key in environment.rb (or somewhere else if you'd prefer)
16
+ I'd suggest copying the configuration code out of your environment.rb and into an initializer named geokit
17
+ This key is good for localhost:3000, signup for more at http://www.google.com/apis/maps/signup.html
18
+
19
+ GOOGLE_APPLICATION_ID = "ABQIAAAA3HdfrnxFAPWyY-aiJUxmqRTJQa0g3IQ9GZqIMmInSLzwtGDKaBQ0KYLwBEKSM7F9gCevcsIf6WPuIQ"
20
+
21
+ # Usage
22
+
23
+ MAP CONTROLS
24
+ ------------
25
+
26
+ maps_controller.rb
27
+ --------------------------
28
+
29
+ class MapsController < ApplicationController
30
+ def show
31
+ @map = GoogleMap::Map.new
32
+
33
+ # define control types shown on map
34
+ @map.controls = [ :large, :scale, :type ]
35
+ # valid controls options include
36
+ # :large
37
+ # :small
38
+ # :overview
39
+ # :large_3d
40
+ # :scale
41
+ # :type
42
+ # :menu_type
43
+ # :hierachical_type
44
+ # :zoom
45
+ # :zoom_3d
46
+ # :nav_label
47
+
48
+ # allow user to double click to zoom
49
+ @map.double_click_zoom = true
50
+
51
+ # not certain what this does
52
+ @map.continuous_zoom = false
53
+
54
+ # allow user to scroll using mouse wheel?
55
+ @map.scroll_wheel_zoom = false
56
+
57
+ end
58
+ end
59
+
60
+ MAP CENTERING AND ZOOM
61
+ ----------------------
62
+
63
+ maps_controller.rb
64
+ ------------------
65
+
66
+ class MapsController < ApplicationController
67
+ def show
68
+ @map = GoogleMap::Map.new
69
+ @map.center = GoogleMap::Point.new(47.6597, -122.318) #SEATTLE WASHINGTON
70
+ @map.zoom = 10 #200km
71
+ end
72
+ end
73
+
74
+ MAP CENTERING USING BOUNDS
75
+ --------------------------
76
+
77
+ maps_controller.rb
78
+ --------------------------
79
+ class MapsController < ApplicationController
80
+ def show
81
+ @map = GoogleMap::Map.new
82
+ @map.bounds = [GoogleMap::Point.new(47.6597, -121.318), GoogleMap::Point.new(48.6597, -123.318)] #SEATTLE WASHINGTON 50KM
83
+ end
84
+ end
85
+
86
+
87
+ SIMPLE MARKER USAGE
88
+ -------------------
89
+
90
+ maps_controller.rb
91
+ --------------------------
92
+ class MapsController < ApplicationController
93
+ def show
94
+ @map = GoogleMap::Map.new
95
+ @map.markers << GoogleMap::Marker.new( :map => @map,
96
+ :lat => 47.6597,
97
+ :lng => -122.318,
98
+ :html => 'My House')
99
+ end
100
+ end
101
+
102
+ maps/show.html.erb
103
+ -------------------------
104
+ <%= @map.to_html %>
105
+ <div style="width: 500px; height: 500px;">
106
+ <%= @map.div %>
107
+ </div>
108
+
109
+
110
+ Advanced Marker Usage
111
+ ---------------------
112
+
113
+ Available icon classes:
114
+ * GoogleMap::LetterIcon.new(@map, 'A') # letter must be uppercase
115
+ * GoogleMap::SmallIcon.new(@map, 'yellow')
116
+
117
+ maps_controller.rb
118
+ --------------------------
119
+ class MapsController < ApplicationController
120
+ def show
121
+ @map = GoogleMap::Map.new
122
+ @map.markers << GoogleMap::Marker.new( :map => @map,
123
+ :icon => GoogleMap::SmallIcon.new(@map, 'blue'),
124
+ :lat => 47.6597,
125
+ :lng => -122.318,
126
+ :html => 'My House',
127
+ :marker_icon_path => '/path/to/image',
128
+ :marker_hover_text => 'String to show on Mouse Over',
129
+ :open_infoWindow => true #opens marker by default
130
+ )
131
+
132
+ end
133
+ end
134
+
135
+ maps/show.html.erb
136
+ -------------------------
137
+ <%= @map.to_html %>
138
+ <div style="width: 500px; height: 500px;">
139
+ <%= @map.div %>
140
+ </div>
141
+
142
+
143
+ PLOTTING POLYLINE ROUTES
144
+ ------------------------
145
+
146
+ maps_controller.rb
147
+ ------------------
148
+ class MapsController < ApplicationController
149
+ def show
150
+ @map = GoogleMap::Map.new
151
+
152
+ # plot points for polyline
153
+ vertices = []
154
+ object.gpxroute.gpxtrackpoints.each do |p|
155
+ vertices << GoogleMap::Point.new(p.lat, p.lon)
156
+ end
157
+
158
+ # plot polyline
159
+ @map.overlays << GoogleMap::Polyline.new( :map => @map,
160
+ :color=>'#FF0000',
161
+ :weight=>'2',
162
+ :opacity=>'.5',
163
+ :vertices=>vertices
164
+ )
165
+ end
166
+ end
167
+
168
+ maps/show.html.erb
169
+ -------------------------
170
+ <%= @map.to_html %>
171
+ <div style="width: 500px; height: 500px;">
172
+ <%= @map.div %>
173
+ </div>
@@ -6,7 +6,7 @@ module GoogleMap
6
6
  alias_method :parent_initialize, :initialize
7
7
 
8
8
  def initialize(map, letter)
9
- parent_initialize(:map=>map, :image_url => "http://www.google.com/mapfiles/marker#{letter}.png")
9
+ parent_initialize(:map=>map, :image_url => "http://www.google.com/mapfiles/marker#{letter.upcase}.png")
10
10
  end
11
11
 
12
12
  end
@@ -1,3 +1,3 @@
1
1
  module GoogleMap
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: google_map
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
4
+ hash: 25
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 2
10
- version: 0.0.2
9
+ - 3
10
+ version: 0.0.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - Jeff Dutil
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-02-22 00:00:00 -05:00
18
+ date: 2011-03-11 00:00:00 -05:00
19
19
  default_executable:
20
20
  dependencies: []
21
21
 
@@ -32,7 +32,7 @@ files:
32
32
  - .gitignore
33
33
  - Gemfile
34
34
  - MIT_LICENSE.txt
35
- - README
35
+ - README.md
36
36
  - Rakefile
37
37
  - google_map.gemspec
38
38
  - lib/google_map.rb
data/README DELETED
@@ -1,180 +0,0 @@
1
- ======================================================
2
- GoogleMap
3
- ======================================================
4
- A RubyGem that and makes generating google maps easy as pie.
5
-
6
-
7
- ======================================================
8
- INSTALL
9
- ======================================================
10
- gem install google_map
11
-
12
-
13
- ======================================================
14
- PLUGIN CONFIGURATION
15
- ======================================================
16
- 1 - Set your Google Maps API Key in environment.rb (or somewhere else if you'd prefer)
17
- I'd suggest copying the configuration code out of your environment.rb and into an initializer named geokit
18
-
19
- # This key is good for localhost:3000, signup for more at http://www.google.com/apis/maps/signup.html
20
- GOOGLE_APPLICATION_ID = "ABQIAAAA3HdfrnxFAPWyY-aiJUxmqRTJQa0g3IQ9GZqIMmInSLzwtGDKaBQ0KYLwBEKSM7F9gCevcsIf6WPuIQ"
21
-
22
-
23
-
24
- ======================================================
25
- MAP CONTROLS
26
- ======================================================
27
-
28
- maps_controller.rb
29
- --------------------------
30
- class MapsController < ApplicationController
31
- def show
32
- @map = GoogleMap::Map.new
33
-
34
- # define control types shown on map
35
- @map.controls = [ :large, :scale, :type ]
36
- # valid controls options include
37
- # :large
38
- # :small
39
- # :overview
40
- # :large_3d
41
- # :scale
42
- # :type
43
- # :menu_type
44
- # :hierachical_type
45
- # :zoom
46
- # :zoom_3d
47
- # :nav_label
48
-
49
- # allow user to double click to zoom
50
- @map.double_click_zoom = true
51
-
52
- # not certain what this does
53
- @map.continuous_zoom = false
54
-
55
- # allow user to scroll using mouse wheel?
56
- @map.scroll_wheel_zoom = false
57
-
58
- end
59
- end
60
-
61
- ======================================================
62
- MAP CENTERING AND ZOOM
63
- ======================================================
64
-
65
- maps_controller.rb
66
- --------------------------
67
- class MapsController < ApplicationController
68
- def show
69
- @map = GoogleMap::Map.new
70
- @map.center = GoogleMap::Point.new(47.6597, -122.318) #SEATTLE WASHINGTON
71
- @map.zoom = 10 #200km
72
- end
73
- end
74
-
75
-
76
- ======================================================
77
- MAP CENTERING USING BOUNDS
78
- ======================================================
79
-
80
- maps_controller.rb
81
- --------------------------
82
- class MapsController < ApplicationController
83
- def show
84
- @map = GoogleMap::Map.new
85
- @map.bounds = [GoogleMap::Point.new(47.6597, -121.318), GoogleMap::Point.new(48.6597, -123.318)] #SEATTLE WASHINGTON 50KM
86
- end
87
- end
88
-
89
-
90
-
91
- ======================================================
92
- SIMPLE MARKER USAGE
93
- ======================================================
94
-
95
- maps_controller.rb
96
- --------------------------
97
- class MapsController < ApplicationController
98
- def show
99
- @map = GoogleMap::Map.new
100
- @map.markers << GoogleMap::Marker.new( :map => @map,
101
- :lat => 47.6597,
102
- :lng => -122.318,
103
- :html => 'My House')
104
- end
105
- end
106
-
107
- maps/show.html.erb
108
- -------------------------
109
- <%= @map.to_html %>
110
- <div style="width: 500px; height: 500px;">
111
- <%= @map.div %>
112
- </div>
113
-
114
-
115
- ======================================================
116
- Advanced Marker Usage
117
- ======================================================
118
-
119
- # Available icon classes:
120
- # GoogleMap::LetterIcon.new(@map, 'A') # letter must be uppercase
121
- # GoogleMap::SmallIcon.new(@map, 'yellow')
122
-
123
- maps_controller.rb
124
- --------------------------
125
- class MapsController < ApplicationController
126
- def show
127
- @map = GoogleMap::Map.new
128
- @map.markers << GoogleMap::Marker.new( :map => @map,
129
- :icon => GoogleMap::SmallIcon.new(@map, 'blue'),
130
- :lat => 47.6597,
131
- :lng => -122.318,
132
- :html => 'My House',
133
- :marker_icon_path => '/path/to/image',
134
- :marker_hover_text => 'String to show on Mouse Over',
135
- :open_infoWindow => true #opens marker by default
136
- )
137
-
138
- end
139
- end
140
-
141
- maps/show.html.erb
142
- -------------------------
143
- <%= @map.to_html %>
144
- <div style="width: 500px; height: 500px;">
145
- <%= @map.div %>
146
- </div>
147
-
148
-
149
- ======================================================
150
- PLOTTING POLYLINE ROUTES
151
- ======================================================
152
-
153
- maps_controller.rb
154
- --------------------------
155
- class MapsController < ApplicationController
156
- def show
157
- @map = GoogleMap::Map.new
158
-
159
- # plot points for polyline
160
- vertices = []
161
- object.gpxroute.gpxtrackpoints.each do |p|
162
- vertices << GoogleMap::Point.new(p.lat, p.lon)
163
- end
164
-
165
- # plot polyline
166
- @map.overlays << GoogleMap::Polyline.new( :map => @map,
167
- :color=>'#FF0000',
168
- :weight=>'2',
169
- :opacity=>'.5',
170
- :vertices=>vertices
171
- )
172
- end
173
- end
174
-
175
- maps/show.html.erb
176
- -------------------------
177
- <%= @map.to_html %>
178
- <div style="width: 500px; height: 500px;">
179
- <%= @map.div %>
180
- </div>