With gmaps4rails there is a way to define a custom marker. But the same one is then shown for each database entry.
How would I show a different marker for each database entry, like in Google Latitude? Preferably through their own database column or through a sprite, if there are only pictures for categories/groups and not individual users.
Building on apneadivings answer, two possibly shorter ways come to mind:
Generic:
def gmaps4rails_marker_picture
{
"picture" => self.image_path, # image_path column has to contain something like '/assets/my_pic.jpg'.
"width" => 32, #beware to resize your pictures properly
"height" => 32 #beware to resize your pictures properly
}
end
In this case, we reuse the category column as the name for the picture:
def gmaps4rails_marker_picture
{
"picture" => "/images/" + self.category + ".png",
"width" => 32, #beware to resize your pictures properly
"height" => 32 #beware to resize your pictures properly
}
end
The only thing missing now, is a way to use sprites. But thats probably impossible.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With