How do I load only markers that are inside the map bounds with gmaps4rails? And of course load new ones after pan and/or zoom.
Directly related to that, how can I get the current boundaries and zoomlevel of the map?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Here is how I did it, I only replace the markers after the user finishes panning or zooming, if you require different behavior then use a different event listener:
In your view (index.html.erb):
At the bottom of your view add:
In application.js (using jQuery):
venues_controller#index:
Venue.rb model (using mongodb and mongoid):