1

I've seen similar posts about this but mine does seem to be related to the db as my latitude and longitude come back okay. Also I am not initializing the map.

As far as I understand the map is already initialized globally, so that does not need to be done in the AddMarker function.

var myLatlng = new google.maps.LatLng(place.longitude,place.latitude);
// -118.2013 & 33.9462 for los angeles

var marker = new google.maps.Marker({
    position: myLatlng,
    title: 'New Marker'
}

marker.setMap(map);

This takes me to the new spot but does not drop a marker.

I am logging out both marker and map in the console and they are both there but the marker.set() just doesn't seem to be working. The marker does not have a public method visible .setMap()in the console either. I am not getting any errors, unless I try to re-initialize the map.

The only thing I can think of is that I must provide an image?

0

Answered by OP in the question:

Immediately after writing this I solved the problem. The lat/log is not the object created by the function above, but just a regular object. The docs are not totally obvious, and used the way they said above which was wrong. Now I have:

var marker = new google.maps.Marker({
    position: {lat: place.latitude, lng: place.longitude},
    title: 'New Marker'
  });
marker.setMap(map);

You must log in to answer this question.

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