Código PHP:
foreach ($view->result as $result) {
$node = node_load($result->nid);
$latitude = $node->location[latitude];
$longitude = $node->location[longitude];
print_r($node->location);
Ahora en el mapa:
Código PHP:
<script src="http://maps.google.com/maps/api/js?sensor=false"></script>
<script>
var marker;
var geocoder = new google.maps.Geocoder();
geocoder.geocode(
{
'address': '<?php echo $node->location[street];?>, <?php echo $ciudad->title;?>, <?php echo $provincia->title;?>, <?php echo $pais->title;?>'
},
function(results, status) {
if (status == google.maps.GeocoderStatus.OK) {
var myOptions = {
zoom: 15,
center: results[0].geometry.location,
mapTypeId: google.maps.MapTypeId.ROADMAP
}
var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
marker = new google.maps.Marker({
map:map,
draggable:false,
animation: google.maps.Animation.BOUNCE,
position: results[0].geometry.location
});
}
}
);
</script>
<?php
} ?>
<div id="map_canvas" style="height:300px;width:700px"></div>