05/02/2009, 22:07
|
| | | Fecha de Ingreso: abril-2007
Mensajes: 354
Antigüedad: 17 años, 9 meses Puntos: 0 | |
mashup google maps con PHP y MYSQL hola amion gos estoy haciendo un mashup para google maps con php y mysql..
pero tengo errores por favor necesito su ayuda.. la idea es sacar las direcciones desde una base datos y utilizar el geoposicionamiento de google... les dejo el codi haber si me ayudan Código PHP:
mysql_select_db($database_reservas, $reservas); $query_Recordset1 = "SELECT * FROM alojamientos"; $Recordset1 = mysql_query($query_Recordset1, $reservas) or die(mysql_error());
$a = 0; while ($row_Recordset1 = mysql_fetch_object($Recordset1)) { $coord_array[$a]['direccion'] = $row_Recordset1-> direccion; $coord_array[$a]['nombre'] = $row_Recordset1-> nombre; $coord_array[$a]['tipo'] = $row_Recordset1-> tipo_alojamiento; $a++; }
?>
este es el java del mapa
Código:
<script>
<?php
$numMarkers = sizeof($coord_array);
for ($i=0; $i<$numMarkers; $i++){
?>
var address_<?php $i ?> = {
street: 'san martin 400',
city: 'san rafael',
state: 'mendoza',
zip: '5600',
country: 'argentina',
infowindow: 'default',
infowindowtext: '<span style="font: 12px Verdana, Arial, Helvetica, sans-serif; color:#000099;"><strong><?php echo $row_alojamiento['tipo']; ?> <?php echo $coord_array[$i]['nombre'] ; ?></strong></span><span style="font: 10px Verdana, Arial, Helvetica, sans-serif; color:#000;"><br /><?php echo $rw_alojamiento['direccion']; ?><br />San Rafael, Mendoza </span>',
full: '<?php echo $coord_array[$i]['direccion'] ; ?>, san rafael, mendoza, 5600, argentina',
isdefault: true
};
function wagt_map_1() {
if(GBrowserIsCompatible()) {
if(!document.getElementById('wagt_map_1')) return false;
var map = new GMap2(document.getElementById('wagt_map_1'));
map.enableContinuousZoom();
map.enableDoubleClickZoom();
map.addControl(new GLargeMapControl());
map.addControl(new GScaleControl());
map.addControl(new GMapTypeControl());
var geocoder = new GClientGeocoder();
var icon = new GIcon();
var markerStyle = 'Star';
var markerColor = 'Poppy';
icon.image = 'http://google.webassist.com/google/markers/star/poppy.png';
icon.shadow = 'http://google.webassist.com/google/markers/star/shadow.png';
icon.iconSize = new GSize(29,39);
icon.shadowSize = new GSize(29,39);
icon.iconAnchor = new GPoint(15,15);
icon.infoWindowAnchor = new GPoint(19,7);
icon.printImage = 'http://google.webassist.com/google/markers/star/poppy.gif';
icon.mozPrintImage = 'http://google.webassist.com/google/markers/star/poppy_mozprint.png';
icon.printShadow = 'http://google.webassist.com/google/markers/star/shadow.gif';
icon.transparent = 'http://google.webassist.com/google/markers/star/poppy_transparent.png';
geocoder.getLatLng (
address_<?php $i ?>.full,
function(point) {
if(point) {
map.setCenter(point, 17);
var marker<?php $i ?>= new GMarker(point<?php $i ?>, icon);
GEvent.addListener(marker, 'click', function() {
marker.openInfoWindowHtml(address_$i.infowindowtext);
});
map.addOverlay(marker);
marker.openInfoWindowHtml(address_$i.infowindowtext);
}
else {
map.setCenter(new GLatLng(37.4419, -122.1419), 17);
}
}
);
}
}
<?php }; ?>
</script>
gracias espero su ayuda |