Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

116
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!