Ruby - Custom logo marker (Google Maps)
Hello person / s who can help.
I am currently working on Google Maps, which will have multiple markers, but each marker will be unique with the company logo in place. The marker background will be the same all the time.
Below is a quick layout on how the markers should look
The basis:
- Same background
- Unique logo for a company (many companies will have a note)
- A company logo loaded with a square shape and will lag behind the blue marker (so don't mind some parts of the logo hidden).
Ruby code
Displaying map marker in map.html.erb
var location = new google.maps.LatLng(data[i]['latitude'], data[i]['longitude'])
bounds.extend(location);
marker = new google.maps.Marker({
position: location,
map: map,
icon:data[i]['image'],
url:data[i]['link']
});
Controller.rb that calls data
def search
@collection = @tours.map do |t|
{"name"=>t.host.company_name,"latitude"=>t.host.latitude,"longitude"=>t.host.longitude,"image"=>t.host.company_logo.url(:thumb),"link"=>host_show_path(t.host.id)}.to_json if t.host.latitude.present? && t.host.longitude.present?
end
The card is working and is already pulling out the company (host) logo that is displayed.
Now you just need to get the general background.
Hopefully someone can help and not sure how to do this.
thank
+3
source to share
No one has answered this question yet
Check out similar questions: