0

The Google Maps Embed API will show the text label for the place ID you specify on the shown map as a standard place label. For example:

Embedded Map

<iframe width="1000" height="1000"
src="https://www.google.com/maps/embed/v1/place?q=place_id:ChIJU6l0ESZu5kcReX4mEjfmJnY&amp;key=YOUR_KEY">
</iframe>

enter image description here

Javascript Map

In contrast, using the Google Maps JavaScript API, if I place a marker on a map using the somewhat undocumented place parameter (not mentioned in MarkerOptions BUT shown in Example using the Places library in the Maps JavaScript API )

...
let marker = new google.maps.Marker({
      map: map,
      place: {
        placeId: "ChIJU6l0ESZu5kcReX4mEjfmJnY",
        location: place.geometry.location
      }
    });

gives the following:

enter image description here

Is there a way to get the Google Maps JavaScript API to show the official place label next to a Marker the way that it does in the embed API? Specifically, looking for red text with white outline, as shown in the embed api example above, and collision avoidance behavior (avoiding overlapping labels).

*The question is similar to the "duplicate" question, but the answer to that question doesn't give the text the look of current google maps nor does it handle collision avoidance (nor does the asker seem to be looking for it)

User
  • 62,498
  • 72
  • 186
  • 247
  • Does this answer your question? [How can I show label/title for marker permanently in Google Maps V3?](https://stackoverflow.com/questions/5603623/how-can-i-show-label-title-for-marker-permanently-in-google-maps-v3) – Yrll Sep 13 '22 at 02:59
  • @Yrll It doesn't. I'm aware how to add a label but I'm asking about more specific features – User Sep 13 '22 at 07:17

0 Answers0