nuids
lmorroni opened this issue · comments
Hi,
I am not sure this is the best spot to ask this question but I don't have a direct email for you. I am leveraging a number of elements from your anymals site and I had a question about the way you are keeping track of the placemarks that are contained in a cluster that is clicked. I saw this line in your .js:
var params = {'lat':position.lat(),'lng':position.lng(), 'nuids':googleMap.filters['nuid']};
I am unclear on how you are using a filter to track these. What is the general concept here? I need to be able to pass a list of placemark identifiers to my Django view on click so I can show the popup.
Thanks!
Larry
Currently I use the K-Nearest Neighbour lookup based on the position. This is not optimal as this will not be exact with big clusters. It only works acceptably with small clusters on big datasets. I think a better solution should be implemented directly in anycluster.
We should avoid passing long lists of pin-ids to the clientside javascript as this will make the clusterer slow.
My first idea is: pass the lat/lng of the cluster via ajax to django, rerun the cluster SQL-query for exactly the one geographic cell it is in and fetch the cluster with the position passed from javascript - this time including IDs in an array_agg or something. We can then pass these IDs to a django view. (User clicks on cluster -> latlng to your view -> view calls clusterer and receives IDs).
Of course I am open for ideas.
I will try to implement this today or tomorrow as I think this is a missing feature.
p.s.: I receive emails that are sent to the "info" address for anymals.org - but I think in this case public is good as it is a missing feature.
I implemented this feature now, an example how to use it is in the javascript file for the google map. An example how to use this in a view can be found in views.py
I also cleaned up the code a bit.