Is it possible to write a custom text on Google Maps API v3 next to the marker, or I can use only the info window to do that?
相关问题
- How do you change the color of the dotted line on
- How do you change the color of the dotted line on
- draw polylines with different colors on v2 maps
- Add HTML class/ID to Google Maps Marker (API V3)
- Cannot resolve method “getMapAsync”
相关文章
- Updating a map marker in android
- Avoiding “Sorry, we have no imagery here” with Goo
- Custom Marker performance iOS, crash with result “
- Google Map Gradient Polylines for Android?
- Angular 6 - @types/googlemaps/index.d.ts' is n
- Google Maps - Get Polygon border of zones/neighbor
- Google Map Marker Clickable Area
- getSupportFragmentManager().findFragmentById retur
The latest (v3) API recommends using
async defer
and a callback when the Maps API is loaded.To make this work you need to define the overlay class from within (or after) the initialization when the
google
class has been defined. Otherwise you will getgoogle not defined
errors.Here is working code:
It the text is static, you can use a marker and an image :
To show custom text you need to create a custom overlay. Below is an example adapted from official Google documentation. You could also use this library for more "stylish" info windows
By far the easiest way to add a Text Overlay is to use the
MapLabel
class from https://github.com/googlemaps/js-map-label