Php 有人知道我的脚本是怎么做的吗? // Create a GMap2 instance var gmap = new GMap2( document.getElementById( 'map' ); // Do all your setup here, l
Php 有人知道我的脚本是怎么做的吗? // Create a GMap2 instance var gmap = new GMap2( document.getElementById( 'map' ); // Do all your setup here, l,php,javascript,google-maps,google-maps-api-2,Php,Javascript,Google Maps,Google Maps Api 2,有人知道我的脚本是怎么做的吗? // Create a GMap2 instance var gmap = new GMap2( document.getElementById( 'map' ); // Do all your setup here, like gmap.setCenter() and such // Now, load the map data loadMapFromCurrentBounds( gmap ); // Assign a handler to the "mo
有人知道我的脚本是怎么做的吗?
// Create a GMap2 instance
var gmap = new GMap2( document.getElementById( 'map' );
// Do all your setup here, like gmap.setCenter() and such
// Now, load the map data
loadMapFromCurrentBounds( gmap );
// Assign a handler to the "moveend" event
GEvent.addListener( gmap, 'moveend', function()
{
loadMapFromCurrentBounds( gmap );
});
function loadMapFromCurrentBounds( gmap )
{
// First, determine the map bounds
var bounds = gmap.getBounds();
// Then the points
var swPoint = bounds.getSouthWest();
var nePoint = bounds.getNorthEast();
// Now, each individual coordinate
var swLat = swPoint.lat();
var swLng = swPoint.lng();
var neLat = nePoint.lat();
var neLng = nePoint.lng();
// Now, build a query-string to represent this data
var qs = 'swLat=' + swLat + '&swLng=' + swLng + '&neLat=' + neLat + '&neLng=' + neLng;
// Now you can use this query-string in your AJAX request
// AJAX-stuff here
}
$swLat = mysql_real_escape_string( $_GET['swLat'] );
$swLng = mysql_real_escape_string( $_GET['swLng'] );
$neLat = mysql_real_escape_string( $_GET['neLat'] );
$neLng = mysql_real_escape_string( $_GET['neLng'] );
$query = "
SELECT *
FROM [Table]
WHERE lat > $swLat
AND lat < $neLat
AND lng > $swLng
AND lng < $neLng
";