You can add custom POIs to a map to identify locations such as stores and buildings, and provide location details with information windows. Text labels of custom POIs support collision and directional avoidance.
Call HWMapJsSDK.HWCustomPoi(customPoiOptions) to add a custom POI.
function initMap() {
var mapOptions = {};
mapOptions.center = {lng: 2.3506770476074217, lat: 48.93245374505838};
mapOptions.zoom = 12;
mapOptions.language = 'en';
mapOptions.sourceType = 'vector';
mapOptions.navigationControl = true;
mapOptions.locationControl = true;
mapOptions.rotateControl = true;
mapOptions.zoomControl = true;
mapOptions.zoomSlider = true;
mapOptions.scaleControl = true;
mapOptions.copyrightControl = true;
map = new HWMapJsSDK.HWMap(document.getElementById('map'), mapOptions);
// Add a custom POI (point 1).
customPoi1 = new HWMapJsSDK.HWCustomPoi({
map,
icon: {
anchor: 'center',
scale: 1,
opacity: 1,
},
label: {
color: '#333',
fontSize: '36px',
text: 'point 1',
offsetX: 0,
offsetY: 0,
},
position: {lat: 49, lng: 2.35},
zIndex: 1,
collisionEnabled: true,
variableLabelAnchor: ['top','bottom','left', 'right'],
});
// Add a custom POI (point 2).
customPoi2 = new HWMapJsSDK.HWCustomPoi({
map,
icon: {
anchor: 'bottom',
scale: 1,
opacity: 1,
},
label: {
color: '#333',
fontSize: '36px',
text: 'point 2',
offsetX: 0,
offsetY: 0,
},
position: {lat: 48.5, lng: 2.35},
zIndex: 1,
collisionEnabled: true,
variableLabelAnchor: ['top','bottom','left', 'right'],
});
} The figure below shows the custom POI text label collision effect.

To delete a custom POI from a map, call the setMap() method and pass null as a parameter of the method.
customPoi.setMap(null);
Call the addListener(type, callback) or removeListener(type, callback) methods of HWCustomPoi to add or delete the listener for the click event.
function handleListener(e) {
console.log(e);
}
// Add a listener for the client event.
customPoi.addListener('click', handleListener);
// Delete the listener for the click event.
customPoi.removeListener('click', handleListener);