Search code examples
google-mapsgoogle-maps-api-3google-maps-markers

Google Maps custom label x and y position


I am trying to adjust the x and y position of my custom label. Is this possible? I haven't come across any documentation regarding this issue as of yet.

numberMarkerImg = {
    url: '../images/mobile/map-marker.png',
    size: new google.maps.Size(32, 38),
    scaledSize: new google.maps.Size(32, 38)
};

// Letter markers
marker = new google.maps.Marker({
    position : point,
    map      : map,
    icon     : numberMarkerImg,
    draggable: false,
    labelClass: "labels",
    label: {
        text: saved_label,
        color: 'black',
        fontSize: '12px',
        x: '200',
        y: '100'
    }
});

Solution

  • "labelOrigin" ended up having to to be passed in since I am using a custom marker.

       numberMarkerImg = {
            url: '../images/mobile/map-marker.png',
            size: new google.maps.Size(32, 38),
            scaledSize: new google.maps.Size(32, 38),
            labelOrigin: new google.maps.Point(9, 9)
       };