Text marker
This article introduces the text marker AMap.Text. The text marker displays plain text. It inherits from AMap.Marker and has most of the properties, methods, and events of AMap.Marker.
Text marker example
1、Add text marker
1
1.1 Create Map
const map = new AMap.Map("container", {
viewMode: "2D",
zoom: 11,
showOversea: true, //Enable world Map
center: [100.491422, 13.749313],
});2
1.2 Add Text instance
var text = new AMap.Text({
text: "Plain text marker", //Mark the displayed text content
anchor: "center", //Set text marker anchor position
draggable: true,
cursor: "pointer",
angle: 10,
style: {
//Set text style, Object same as CSS style sheet
"padding": ".75rem 1.25rem",
"margin-bottom": "1rem",
"border-radius": ".25rem",
"background-color": "white",
"width": "15rem",
"border-width": 0,
"box-shadow": "0 2px 6px 0 rgba(114, 124, 245, .5)",
"text-align": "center",
"font-size": "20px",
"color": "blue",
},
position: [100.748227, 13.697617],
});
text.setMap(map);