On Jan 25, 8:39 am, scotth <[email protected]> wrote:
> I have successfully used a PHP/Javascript/MySQL mix to display markers
> from a database where lat/long locations are stored.
>
> This is easy because you get your lat/long from your MySQL database,
> use PHP echo statements to write the required API javascript, do the
> MySQL queries and everything's great.
>
> But how, given a user moving the viewport, do I pass the
>    var bounds = map.getBounds();
>    var southWest = bounds.getSouthWest();
>    var northEast = bounds.getNorthEast();
> stuff back to PHP. I want to decide which markers to display using PHP/
> MySQL but the bounds information is in Javascript at that point.

Use GDownload/GXmlHttp to transfer the bounds to the server in the
request for updated markers.  You should look into AJAX (see Mike
Williams' tutorial article for an explanation).

  -- Larry

>
> best regards
>
> Scott
>
> P.S. Here's how I did my code (simplified):
> <?
>   $lat = 90; $long = 45; $zoom=17;
>   $ww = $long+2; $nn = $lat+2; $ee = $long-2; $ss = $lat-2;
> ?>
>
> function load () {
>
> <?
>    echo "        map.setCenter(new GLatLng($lat, $long), $zoom);\n\n";
>    $result = mysql('db', "select * from page where longitude>$ww and
> longitude<$ee and latitude>$ss and latitude<$nn");
>    while (database_entries)
>    {
>          echo "        var point = new GLatLng($hlt, $hln);\n";
>          echo "        var marker = createMarker(point, '$hs',
> '$htype', '$hname');\n";
>    }
> ?>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Maps API V2" 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