Using Gmaps.map.replaceMarkers() I can replace entire marker set. But in my application I will use more than 3000 markers.
How to replace one marker or subset of markers?
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.
This is definitely possible but because there is no rule, there is custom code to write.
Here is how I proceed generally:
I add some custom data in the marker’s json, the
idof the active record’s object generallyI sort my markers client side in javascript variables, say you have the ids of markers you want to remove in a js array called
toClearI remove useless markers:
Coffeescript:
Gmaps.addMarkers new_markers_array