Page 1 of 1

PTV Developer Vector Maps and Icons...

Posted: Mon Mar 24, 2025 12:09 pm
by Marko Cancar
One of my clients wants to build a web application with the PTV Vector Maps.

How can he display specific icons at geo-coordinates he just geocoded?

Thanks and regards,
Marko

Re: PTV Developer Vector Maps and Icons...

Posted: Mon Mar 24, 2025 12:29 pm
by Bernd Welter
Hi Marko,

the answer to your question depends on the chosen mapping framework.
In the Developer tutorials we use the MapLibre library (a community driven fork of MapBox GL)

I just checked the Tutorials: position matching looks promising.
VectorMap-icons.png

Code: Select all

function addMarker(lngLat, textAsHtml) {
  const popup = new maplibregl.Popup({closeButton: false})
    .setHTML(textAsHtml);
  const marker = new maplibregl.Marker()
    .setLngLat(lngLat)
    .setPopup(popup)
    .addTo(map);
  mapMarker = marker;
  marker.togglePopup();
}
function clearMarker() {
  if (mapMarker) mapMarker.remove();
  mapMarker = undefined;
}