Search code examples
angularjsopenlayers-3angular-openlayers

Angular OpenLayers - Marker size


Is it possible to change marker's custom icon image size? If i set inside style size like this

style: {
    image: {
        icon: {
            anchor: [0.5, 0.5],
            anchorXUnits: 'fraction',
            anchorYUnits: 'fraction',
            opacity: 1,
            size: [12, 12]
            src: 'images/map-marker.png'
            }
        }
    }

it only changes markers size on 12px x 12px but inside image stays in original size. Can i change size of image that I'm using for marker using directive?


Solution

  • After some research i found answer. There is parameter scale in OpenLayers3 ol.style.Icon and it can be used in angular-openlayers directive.

    style: {
        image: {
            icon: {
                anchor: [0.5, 0.5],
                anchorXUnits: 'fraction',
                anchorYUnits: 'fraction',
                opacity: 1,
                scale: 0.5,
                src: 'images/map-marker.png'
                }
            }
        }
    

    I used this question for help How do I decrease the size of Icon in openlayers 3, i am using bing maps