I want to take a list of lat lon points and sort / toggle their display based on their proximity. Ideally, I would like to do this on the client side. For instance, I often see maps that update a list based on the view of the current map. It appears that as you move the map or change the zoom of the map, it makes a separate query on every change and updates the results. It seems to me much more efficient to load a larger set of values, and then toggle the visibility and order based on the map zoom. I'm wondering if anyone has a technique for doing this or if anyone has ever attempted this using javascript.
Asked
Active
Viewed 147 times
2
1 Answers
0
If you load a lot of markers than why hide them and not show them the whole time?As for the zoom you can use a marker clusterer.The other solution you are suggesting requires you to spatial query the markers(and probably implement the logic by yourself since i don't know any way that it can be done with the api) on the client according to the map viewport.
Yes it would probably be more efficient but the question is how would you know which portions the user will explore so you can prefetch the markers?
Cheers

Argiropoulos Stavros
- 9,436
- 11
- 61
- 79
-
thanks for your input, to give an example if you look at realestate sites like zillow or trulia, everytime you change the map viewport in the slightest, it makes a new call to the server for new results. It seems to really tax the server, and it occurred to me it might make sense to load a larger set, and simply toggle the view (not just the map but the list view) based on the viewport. There is some stuff baked into php that allows you to do spacial queries, was just wondering how you would implement something similar on the client side. – user379468 Feb 22 '12 at 17:43
-
I think that by "baked in php" you mean the spatial queries against a spatial db.There is no similar way in the browser simly because you don't have spatial db in the browser.You must implement this logic by yourself – Argiropoulos Stavros Feb 23 '12 at 09:15