3. What all you need at Model level?
Latitude, Longitude and gmaps4rails_address
In model:
acts_as_gmappable :process_geocoding => false
def gmaps4rails_address
end
If your model do not have the latitude or
longitude as fields, then you can delegate it or
add instance methods.
5. Map Configuration:
detect_location: false
center_on_user: false
(centers map on the location detected through the
browser )
auto_zoom: true
zoom : 1 (initial zoom. Set, 'auto_zoom' to false before
setting 'zoom' value. This enables the 'zoom' value to
overide the default.)
maxZoom: null
minZoom: null
auto_adjust: true (adjust the map to the markers if set to
true)
7.
Add markers with js using addMarkers()
Example:
var home_pin = [{picture:
"/assets/referral_engine/pins/home.png", width:
32, lat: "#{@practice.latitude}", lng:
"#{@practice.longitude}"}];
Gmaps.map.addMarkers(home_pin)
8.
9. Cluster
Cluster attributes:
•
do_clustering : to cluster markers, default to false
clusterer_gridSize: the more the quicker but the less
precise, default to 50
clusterer_maxZoom: define at which zoom level
clusterer is disabled, default to 10
•
•
Example:
= gmaps("markers" => { data: json, options:
{clusterer_gridSize: 25, do_clustering: true,
clusterer_maxZoom: 20} })
14. Issues:
Full zoom-out for single pin
•
Solution: on map-load check the zoom-level
and adjust accordingly using setZoom()
Display only latest for multiple locations at
same place
• Solution: create group of such locations and add
while creating info-window for that location
include the info of all those grouped locations