Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've playing around with the google maps api and am puzzled at the following behavior. If I use mPoint as the LatLng for my marker, the marker is rendered on a different point on the map as opposed to putting the same value directly into the properties of the marker. Code chunk is as follows:

        var mPoint = [new google.maps.LatLng(38.991300,-76.936165)];
//        var GPoint = new google.maps.Marker({map:map,position:AVPoint});
  var marker = new google.maps.Marker({
    map: map,
    position: new google.maps.LatLng(38.991300,-76.936165),
    //position: new google.maps.LatLng(mPoint),
    draggable: true

Why would this happen?

share|improve this question

In your code:

var mPoint = [new google.maps.LatLng(38.991300,-76.936165)];

You define an array as mPoint. And it absolutely makes no sense to pass this array to the marker object that you are creating since the position attribute expects a latlng object and not an array as argument.

In your case var marker = new google.maps.Marker({map: map,position: mPoint[0], draggable: true}); would be the solution.

share|improve this answer

Google Maps Marker Example (with drop/drag animation) reference:

  var mPoint = new google.maps.LatLng(38.991300,-76.936165);
  var marker;
  var map;

  function initialize() {
    var mapOptions = {
      zoom: 13,
      mapTypeId: google.maps.MapTypeId.ROADMAP,
      center: mPoint

    map = new google.maps.Map(document.getElementById('map_canvas'),

    marker = new google.maps.Marker({
      animation: google.maps.Animation.DROP,
      position: mPoint
    google.maps.event.addListener(marker, 'click', toggleBounce);

  function toggleBounce() {

    if (marker.getAnimation() != null) {
    } else {


share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.