I am trying to add a 4 character label (eg 'A123') to a Google Maps marker which has a wide icon defined with a custom path.
var marker = new google.maps.Marker({
position: latLon,
label: { text: 'A123' },
map: map,
icon: {
path: 'custom icon path',
fillColor: '#000000',
labelOrigin: new google.maps.Point(26.5, 20),
anchor: new google.maps.Point(26.5, 43)
scale: 1,
}
});
The marker label API is restricted to a single character, so just shows a marker with 'A' in the example above. I have tried using chrome developer tools to hack the html which is created by gmaps and reinstate the longer label. It displays perfectly with no modifications to the css required, so I just need to find a way to reinstate the other label chars which Google maps has stripped.
I raised a Google Maps Issue to request that this restriction be lifted. Please consider voting for the Google issue by visiting link above and starring the issue to encourage Google to fix it - thanks!
But in the meantime, is there a workaround I can use to remove the one char restriction?
Is there a way I can create a custom extension of google.maps.Marker to show my longer label?