Add *.png icons on mapstore map

70 views
Skip to first unread message

Himanshu Mishra

unread,
Oct 7, 2021, 5:14:18 AM10/7/21
to mapstore-developers
Hi Team,

We import shape files and display it on mapstore map. Currently we are using svg to display points on the mapstore map.

style = {
        'iconAnchor': [0.5, 0.5],
        'anchorXUnits': 'pixels',
        'anchorYUnits': 'pixels',
        'size': radius,
        'symbolUrl': symbolUrl,
        'shape': 'square',
         };

We are looking forward for a way to display points using *.png icons. Is there a way we can provide path of *.png similar to how we are displaying svg ? Something like below?
style = {
        'iconAnchor': [0.5, 0.5],
        'anchorXUnits': 'pixels',
        'anchorYUnits': 'pixels',
        'size': radius,
        'src': '/assets/gis/images/pushpin.png',
         };

Note : I tried below  however it did not work:
style = new Style({
        image : new Icon({
            anchor: [0.5, 0.5],
            //anchorXUnits: 'pixels',
            //anchorYUnits: 'pixels',
            src: '/assets/gis/images/pushpin.png',
            opacity: 1
        })
    });
Style and  Icon are part of 'ol/style'
I did not find any direct way to add *.png on map  in mapstore documentation, hence I tried using open layers which anyways did not work.

Any quick suggestion or help would be great!!

Looking forward for a reply.

Regards,
Himanshu Mishra

Reply all
Reply to author
Forward
0 new messages