I need to display multiple names inside marker -> Popup with the doctor's name and its own url. But now, if the address is the same in the map, only one marker comes although several doctors can be in the same place. So I want to know how many times the address is called and I want to display all the information concerning these markers that are present at the same place.
function DoctorsMap({ doctors_list, alternative_list, center, i18n }) {
console.log(alternative_list)
const iconMarkup = renderToStaticMarkup(
<img src={config.domainUrl + "/src/client/assets/images/marker-icon.png"} />
);
const customMarkerIcon = divIcon({
html: iconMarkup,
iconSize: [25, 41],
iconAnchor: [12, 41],
});
return (
<MapContainer
id={"map"}
center={center}
zoom={8}
style={{
marginBottom: "20px",
width: "100%",
height: "100vh",
zIndex: 0,
}}
>
<TileLayer
attribution='© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
url="https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png"
/>
<UpdateMapCentre mapCentre={center} />
{doctors_list &&
doctors_list.length > 0 &&
doctors_list.map((item, index) => {
return (
item.office_address.length > 0 &&
item.office_address.map((el, i) => {
return (
el.latitude &&
el.longitude && (
<Marker
key={index + i}
// icon={new Icon({iconUrl: markerIconPng, iconSize: [25, 41], iconAnchor: [12, 41]})}
icon={customMarkerIcon}
position={[el.latitude, el.longitude]}
>
<Popup>
<Link to={"/profile/" + (i18n.language == 'FR' ? item.url : item['url_'+i18n.language.toLowerCase()])}>{item.name}</Link>
//for example I want several links here
</Popup>
</Marker>
)
);
})
);
})}
</MapContainer>