Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

142
Visualizações
How to remove map route for HERE map API

I currently have a function drawing a map line when clicking on an option, however I only want one to be displayed at a time, so that when the user clicks on another option, it erases the previously drawn route, then draws a new one. I've tried to research how to do this but have come up with nothing.

function addRouteShapeToMap(route) {
  route.sections.forEach((section) => {
    let linestring = H.geo.LineString.fromFlexiblePolyline(section.polyline);
    let polyline = new H.map.Polyline(linestring, {
      style: {
        lineWidth: 8,
        strokeColor: "rgba(207, 0, 15, 1)",
      },
    });

    map.addObject(polyline);
  });
}
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

You should be able to remove the polyline, or generally any added map object, with the method removeObject. This assumes you keep a reference to the polyline outside the function which adds it to the map, or else you could iterate over map objects retrieved with map.getObjects to find it.

map.removeObject(polyline);

See the API Reference

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda