I use a mysql query like this:

SELECT article_id, article_subject, article_lat, article_lng FROM
myTable WHERE map_enabled='y' AND (article_lat<$ne_lat AND article_lat>
$sw_lat) AND (article_lng<$ne_lng AND article_lng>$sw_lng) ORDER BY
article_subject;

My javascript builds the query:

var mapBounds=map.getBounds(), sw=mapBounds.getSouthWest(),
ne=mapBounds.getNorthEast();
var queryUrl='scripts/get_locations.php?ne_lat='+roundNum(ne.lat())
+'&ne_lng='+roundNum(ne.lng())+'&sw_lat='+roundNum(sw.lat())
+'&sw_lng='+roundNum(sw.lng());

http://searchwestnorfolk.org.uk/map/map.php?cat_id=1

The map loads with a category of markers.
Hit the 'Show all locations' button and the map now requests marker
data from mysql as it's panned and zoomed using this method.

Martin.




On 16 Nov, 02:16, tizius <[EMAIL PROTECTED]> wrote:
> Ralph: I tried your solution. It's better than mine but not very
> accurate in placing the cluster markers. I guess that is due to the
> average latitude and longitude.
> Mika: Your script is excellent. I think that clustering by distance is
> the better idea, but I don't know if I can do all that math in a sql
> query. Anyway I'll try.
>
> Thank you both!
>
> On 14 Nov, 18:17, "Barry Hunter" <[EMAIL PROTECTED]> wrote:
>
> > On Fri, Nov 14, 2008 at 4:17 PM, tizius <[EMAIL PROTECTED]> wrote:
>
> > > I've seen that site.
> > > It is nice but I think he clusters the markers dividing map to
> > > squares.
>
> > Yes - as does your query. (ok just very small squares!)
>
> > > I'm trying to group the markers directly with a mysql query.
>
> > You could do GROUP BY FLLOR(lat/10), FLOOR(lon /10)
>
> > to get you 'squares' of 10th of a degree.
>
> > You could vary the 10 dynamically to change the size of the squares
> > (depending on zoom level?)
>
> > Otherwise you perhaps need to clarify what you mean.
>
> > I seriouslly doubt you will be able to do anything like 
> > this:http://googlemapsapi.martinpearman.co.uk/readarticle.php?article_id=1
> > directly in the database.
>
> > - at least without precalulations - assigning scores to points and
> > selecting the top X results with an extents...
>
> > > On 14 Nov, 04:11, Ralph Ames <[EMAIL PROTECTED]> wrote:
> > >> >I've searched everywhere and I didn't succed in finding a query.
> > >> >Is it possible? And if it is, can someone provide an example query?
>
> > >> Probablyhttp://maps.forum.nu/server_side_clusterer/
>
> > >> Ralph
>
> > --
> > Barry
>
> > -www.nearby.org.uk-www.geograph.org.uk-
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to