maps

by mdineshkumarcs

HTML

<html>
<head>
    <style type="text/css">
    html,
    body,
    #map-canvas {
        height: 100%;
        margin: 0px;
        padding: 0px
    }
    </style>
</head>
<body>
    <script src="https://maps.googleapis.com/maps/api/js?sensor=true"></script>
    <div id="map-canvas"></div>
    <script type="text/javascript">
    
    function initialize() {
        
        // start the geolocation API
        if (navigator.geolocation) {
            // when geolocation is available on your device, run this function
            navigator.geolocation.getCurrentPosition(success);
        } else {
          // when no geolocation is available, alert this message
          alert('Geolocation not supported or not enabled.');
        }
    }

    function success(position){
         /*   var coords = new google.maps.LatLng(position.coords.latitude, position.coords.longitude);
            var options = {
              zoom: 15,
              center: coords,
              mapTypeControl: false,
              navigationControlOptions: {
                style: google.maps.NavigationControlStyle.SMALL
              },
              mapTypeId: google.maps.MapTypeId.ROADMAP
            };
            map = new google.maps.Map(document.getElementById("map-canvas"), options);

            var marker = new google.maps.Marker({
                position: coords,
                map: map,
                title:"You are here!"
            });
			*/
		//var coords = new google.maps.LatLng(position.coords.latitude, position.coords.longitude);
        var coords = new google.maps.LatLng(9.17, 79.40);

        var mapOptions = {
            zoom: 15,
            center: coords,
            mapTypeId: google.maps.MapTypeId.TERRAIN
        };

        var map = new google.maps.Map(document.getElementById('map-canvas'),
            mapOptions);
        var marker_0 = new google.maps.Marker(
            {
                position: coords, 
                title:"0"
            }
        );

...