0

In short, the code I've got is almost identical to that given on the maps api page, yet no markers show up on the map. So what's wrong with this:

function addMarker(place)

    {
        var myLatLng = {lat: parseFloat(place.latitude), lng: parseFloat(place.longitude)};
        var name = place.place_name + ", " + place.admin_name1;

        var marker = new google.maps.Marker({
            posistion: myLatLng,
            map: map,
            title: name
        });

        markers.push(marker);
    }

At this point I'm only trying to get the markers to show up - I know the use of title is wrong etc. Any help is appreciated, because to me this should be working. I've seen that most people use the MarkerWithLabel with function, however the link which points to its documentation in the spec is dead, so that could be the issue.

Thanks in advance for any pointers.

EDIT

I've now tried the method that utilises the MarkerWithLabel function, as it seems that is what is bundled with the distribution code. My code now reads as:

function addMarker(place)
{
    var myLatLng = new google.maps.LatLng(place.latitude, place.longitude);
    var name = place.place_name + ", " + place.admin_name1;

    var marker = new MarkerWithLabel({
        posistion: myLatLng,
        map: map,
        labelContent: name
    });

    markers.push(marker);
}

However, there are still no markers on the map.I see a few overlapping labels, but that is all. The map then locks up, and if I can into the console tab I see the following: enter image description here

Where the number of errors goes up whenever I use the scroll wheel. I feel like I'm missing something very obvious, but I've hit a wall regardless. Any help appreciated.

1

Man... I feel bad for you after seeing this and thinking how many hours you've wasted trying to find this typo, so I'll just point it out to you immediately: You wrote "posistion".

3
  • 1
    Wow, I feel dumb now - thanks a lot man! – Finn Ashley Oct 25 '16 at 13:01
  • Haha! Happened now to you, has happened to me and will eventually happen to every programmer in the history of mankind! – Yuri Laguardia Oct 25 '16 at 13:20
  • Oh no! I couldn't believe this answer was actually a thing... until I realized that my code says "positon" .. the struggle is real. – uid100 Jan 2 '20 at 20:51

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .