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

119
Visualizações
mapsjs-core.js:27 Uncaught TypeError: Cannot read properties of undefined (reading '0')

I need help

I work with the here map api I try to display the contours around a city and I have this as an error

const shape = res.response.isoline[0].component[0].shape.map(z => z.split(','));

here is the complete piece of code

const requestIsolineShape = options => { const params = { 'mode': fastest;${options.mode};traffic:enabled, 'start': geo!${options.center.lat},${options.center.lng}, 'range': options.range, 'rangetype': options.rangeType, 'departure': ${options.date}T${options.time}:00, };

return new Promise((resolve, reject) => { router.calculateIsoline( params, res => { const shape = res.response.isoline[0].component[0].shape.map(z => z.split(',')); resolve( shape ); }, err => reject(err) ); }); } ;

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

Please double check in console(Network tab) of browser which parameters are sent to Routing isoline service and check the response.

It seems are you using Routing API v7.2 then please play with playground on https://refclient.ext.here.com/ - click there on "New Tab +"

Better solution if you switch to new version 8 of Routing API and use this service which direct integrated to JS API: https://developer.here.com/documentation/maps/3.1.30.7/api_reference/H.service.RoutingService8.html#calculateIsoline

Example:

let routingParams = {
 'routingMode': 'fast',
 'transportMode': 'car',
 'origin':'52.5,13.4',
 'range[type]': 'time',
 'range[values]': '900',
};

// Define a callback function to process the routing response
let onResult = function(result) {
  if (result.isolines.length) {
    result.isolines[0].polygons.forEach((polygon) => {
        // Create a linestring to use as a point source for the isoline
        const linestring = H.geo.LineString.fromFlexiblePolyline(polygon.outer);

        // Create a polygon and a marker representing the isoline
        const isolinePolygon = new H.map.Polygon(linestring, {
          style: { strokeColor: 'blue', lineWidth: 3 }
        });

        // Create a marker for the start point
        const isolineCenter = new H.map.Marker(result.departure.place.location);

        // Add the polygon and marker to the map
        map.addObjects([isolinePolygon, isolineCenter]);

        // Center and zoom the map so that the whole isoline polygon is
        // in the viewport
        map.getViewModel().setLookAtData({bounds: isolinePolygon.getBoundingBox()});
    });
  }
};

// Assumption: the platform is instantiated.
// Get an instance of the routing service
let router = platform.getRoutingService(null, 8);

// Call the Isoline Routing API to calculate an isoline
router.calculateIsoline(
  routingParams,
  onResult,
  console.error
);

Playground for v8: https://demo.routing.ext.here.com/

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