1

code

var LatLng = {lat: place.latitude, lng: place.longitude};
var marker = new google.maps.Marker({
position: LatLng,
map: map,
title: place.place_name + ", " + place.admin_name1,     
label: place.place_name + ", " + place.admin_name1,
});

markers.push(marker);

gives
this

How to move label outside the icon?
Yes, i looking through the site about it, but
1) We may use regular Marker, not MarkerWithLabel
2) In https://developers.google.com/maps/documentation/javascript/markers example is with label inside an icon and not asingle hint howto take it outside
3) In Pset8: How to set label position and font? written:
"Yes the keyword for it is "anchorPoint" see the reference for google.maps.MarkerOptions"
I can't get how to use it properly from https://developers.google.com/maps/documentation/javascript/3.exp/reference#MarkerOptions

Can you give more info?This is so unclear for now

2
  • 1
    What does adding an option like anchorPoint:new google.maps.Point(0, -10) to the MarkerOptions object do? – Blauelf Jan 16 '18 at 9:06
  • @Blauelf, looks like this defines an offset from the marker's position for some value. Offset determines by coordinates x and y ((0, -10) in your example). But how to use this as an option in marker definition? If add at the bottom after the rest options - nothing changes. Or somehow should be defined that anchor is related to the label? – Nazariy Kushnir Jan 16 '18 at 20:02
1

If you use a custom icon for your marker, you can set its labelOrigin to place it underneath. https://developers.google.com/maps/documentation/javascript/markers (and then look for custom icons)

1
  • Thank you, that exactly what was needed. – Nazariy Kushnir Jan 17 '18 at 19:25

You must log in to answer this question.

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