Here is an example from my db of a query when my map is zoomed all the way out. name | lat | long -----------+---------------------+---------------------- 39.7-86.0 | 39.7434933103448276 | -86.0906621724137931 39.7-86.1 | 39.7460339669421488 | -86.1254463636363636 39.8-86.0 | 39.8098234693877551 | -86.0851046938775510 39.7-86.2 | 39.7948712585034014 | -86.2151087414965986 39.8-86.2 | 39.8122642975206612 | -86.2361142148760331 39.7-86.1 | 39.7443723577235772 | -86.1464871815718157 39.9-86.1 | 39.9715573563218391 | -86.1588194252873563 39.8-86.1 | 39.8788130226700252 | -86.1498961209068010 39.9-85.9 | 39.9086486710239651 | -85.9189234204793028 39.7-86.0 | 39.7932940533333333 | -86.0743115466666667
The name is the cluster name and I use the lat/log average from the results to place the point on the map. You could have the db average for you, but in my case I send extra data for the info window which I concatenate. To make the cluster name, I have a db function (maptrunc) that takes the lat/long and a scale factor. The scale factor is how many decimal places to show. SELECT maptrunc(lat, 1)::text || maptrunc(long, 1)::text AS name The sample says the cluster should only have 1 decimal pace of precision since I am zoomed out. Woody On Tue, Jul 28, 2009 at 3:45 PM, notaplayer83 <[email protected]>wrote: > > Hi :) > > I need the same thing. We have (or will have) like 1 million points in > our database which will move constantly since they're cars and > cellphones so I've been working on a solution with PHP and MySQL with > no success, it's really slow, it can take like 8 seconds to bring the > clusters information and it's supposed to be updated fast cause the > cars keep moving and it needs to be as real time as possible. > > Your idea sounds good: would you explain a little more? I understood > you bring the lat, long, and the lat and long rounded depending on the > zoom from the database. Then you group them using the rounded values > and the lat and long of your cluster is the average of the grouped > points? > > Please correct me if I got something wrong, and thanks for your > answer :) > > Reine. > > > -- iGLASS Networks www.iglass.net --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google Maps API" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/Google-Maps-API?hl=en -~----------~----~----~----~------~----~------~--~---
