I’m using the v5 of Maps SDK for Web and I need a way to identify a marker. I’m storing them in an array, but I have no way to identify them. In v4, I identified using the title property, but I didn’t find anything related to that in v5.
ok, that could work! Thanks!
Just another thing, would you mind helping me with the other problem.
I have no idea what I’m doing wrong, but the markers are not showing in v4. Here is the code. BTW, I’m using react.
I also had this issue, we used to use Google Maps and just tagged the marker with the id. I got round this in TomTom using the following:
var ele = document.createElement("img");
ele.src = iconURL;
$(ele).css("cursor", "pointer");
var markerOptions = {
element: ele,
anchor: "left",
offset: [-15, -8]
};
location_marker = new tt.Marker(markerOptions).setLngLat(lngLat).addTo(map)
location_marker.driverId = trackingInfo.l; // EXTRA DATA ATTACHED TO THE MARKER
location_marker.vehicleId = trackingInfo.v;
location_marker.lastUpdateDate = currDate;
$(ele).attr("type", "driver");
$(ele).data("marker", location_marker); // REFERENCE BACK TO THE MARKER FROM THE ELEMENT
trackingMarkerArray[trackingInfo.l] = location_marker;