First off, I am a complete Google Maps dummy and gathered information
here and there to get some new things working on a site I am building.
Right now it has come to a halt, as far as Google Maps is concerned
and I would like to have some help on the issue. First off, let me
show you what I have so far.

<script type="text/javascript" src="http://maps.google.com/maps/api/js?
sensor=false"></script>
<script type="text/javascript">
  var map;
  var marker;
  var overlay;

  function initialize() {
    var latlng = new google.maps.LatLng('. $_SESSION['x'] .', '.
$_SESSION['y'] .');
    var myOptions = {
      zoom: 13,
      center: latlng,
      mapTypeId: google.maps.MapTypeId.HYBRID
    };

    map = new google.maps.Map(document.getElementById("map_canvas"),
myOptions);

    google.maps.event.addListener(map, \'click\', function(event) {
      placeMarker(event.latLng);
    });

    overlay = new google.maps.OverlayView();
    overlay.draw = function() {};
    overlay.setMap(map);
  }

  function placeMarker(location) {

    if (marker != null) {
      marker.setMap(null);
    }

    marker = new google.maps.Marker({
        position: location,
        map: map
    });

    var mapType        = map.mapTypes[map.getMapTypeId()];

    var mapPixel       =
mapType.projection.fromLatLngToPoint(location);
    var containerPixel =
overlay.getProjection().fromLatLngToContainerPixel(location);
    var divPixel       =
overlay.getProjection().fromLatLngToDivPixel(location);

    document.getElementById("coords").value = "Coordinates: " +
location.lat() + ","+ location.lng() + ".";

  }
</script>

Now, the last line is what I want to have, but now for the address of
where the 'user' is gonna drop the marker and will also be send to,
for example, a form text field called "address".

I messed so much with the above script I am sure there are some errors
in there, so please, be gentle. ;)

-- 
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