Subversion Repositories Sites.obs-saisons.fr

Rev

Blame | Last modification | View Log | RSS feed

var map;
var marker;

function verifierEtLocaliserCoordonnees() {
        
        var lat = $('#station_lat').html();
        var lon = $('#station_lon').html();
        
        if(!isNaN(lat) && lat.length > 0 && !isNaN(lon) && lon.length > 0) {
                
        } else {
                //window.alert("coordonnées invalides");
        }
        
        var positionMarker = new google.maps.LatLng(lat, lon);
        
        marker.setPosition(positionMarker);
        map.setCenter(positionMarker);
}

function initialiserCarte() {

        var latlng = new google.maps.LatLng(47.0504, 2.2347);
        var myOptions = {
                zoom: 6,
                center: latlng,
                mapTypeId: google.maps.MapTypeId.HYBRID
        };

        map = new google.maps.Map(document.getElementById("map_canvas"),
        myOptions);
        
        marker = new google.maps.Marker({
              position: latlng,
              title:""
        });
        
        marker.setDraggable(false);
        marker.setClickable(true);
        
        // To add the marker to the map, call setMap();
        marker.setMap(map); 
}

$(document).ready(function() {
        initialiserCarte();
});

$('#conteneur_liens_lat_lon').ready(function() {
        verifierEtLocaliserCoordonnees();
});