1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
|
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false&language=fr"></script>
<script type="text/javascript">
var data =[
<?php
$sqle = mysql_query("SELECT * FROM product WHERE region = '".$_GET['id']."'");
while($rowe = mysql_fetch_object($sqle))
{
?>
{ adresse : ' <?php echo $rowe->cp; ?> <?php echo $rowe->ville; ?>, FRANCE'},
<?php } ?>
{ adresse : '' }
];
var geocoder;
var oMap;
var oBounds = new google.maps.LatLngBounds();
function initCarte() {
geocoder = new google.maps.Geocoder();
<?php
$requete = mysql_query("SELECT * FROM region WHERE id = '".$_GET['id']."'");
if ($result = mysql_fetch_object($requete))
{
?>
var latlng = new google.maps.LatLng(<?php echo $result->lat; ?> ,<?php echo $result->long ;?>);
var myOptions = {
zoom : 8,
center : latlng = new google.maps.LatLng(<?php echo $result->lat; ?> ,<?php echo $result->long ;?>),
backgroundColor : '#fff',
mapTypeId: google.maps.MapTypeId.HYBRID,
scrollwheel: false,
zoomControl: false,
streetViewControl: false,
panControl: false
}
oMap = new google.maps.Map(document.getElementById("div_canvas"), myOptions);
for( var param=0; param < data.length; param++){
codeAddress( data[param].adresse);
}
}
function codeAddress(address){
geocoder.geocode( { 'address': address}, function(results, status) {
if( status == google.maps.GeocoderStatus.OK) {
oBounds.extend(results[0].geometry.location);
var marker = new google.maps.Marker({
map : oMap,
position: results[0].geometry.location
});
oMap.fitBounds( oBounds);
}
});
}
google.maps.event.addDomListener(window, 'load', initCarte);
</script><?php } ?> |
Partager