I want to convert Lat/Lng to view point and I don't understand what is
wrong with this code:

thanks

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://
www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=ISO-8859-1">
<title>Insert title here</title>
        <style type="text/css">
      #map {
        width: 800px;
        height: 600px;
      }

      #latlng-control {
        background: #ffc;
        position: absolute;
        top:100px;
        left:100px;
        width:150px;
        height:40px;
      }
    </style>

<script type="text/javascript" src="http://maps.google.com/maps/api/js?
sensor=false"></script>
<script type="text/javascript">
        var map;
        function init() {
        var centerLatLng = new
google.maps.LatLng(37.748582,-122.418411);
        map = new google.maps.Map(document.getElementById('map'), {
          'zoom': 10,
          'center': centerLatLng,
          'mapTypeId': google.maps.MapTypeId.ROADMAP
        });
        registerListener();
        }

        function registerListener(){
        google.maps.event.addListener(map, 'mousemove',
function(mEvent) {
                var point =
map.getProjection().fromLatLngToPoint(mEvent.latLng);
                var elem = document.getElementById('latlng-control');
                elem.innerHTML = point.x+"<br>"+point.y;
          });
        }

    google.maps.event.addDomListener(window, 'load', init);
        </script>
</head>
<body>
        <div id="map"></div>
        <div id="latlng-control"></div>
</body>
</html>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Maps JavaScript API v3" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-maps-js-api-v3?hl=en.

Reply via email to