Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

140
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda