osrm-isochrone icon indicating copy to clipboard operation
osrm-isochrone copied to clipboard

TypeError: Cannot read property '24' of undefined

Open tomershay opened this issue 7 years ago • 4 comments

Hi,

I was trying to follow the instructions to get the sample js working and got the error below. Few details that might help -

  1. I download the following OSM file, and used osm extract and osm contract on it. The instructions mentioned osm prepare, but I saw a tutorial that mentioned osm contract (as osm prepare doesn't exist in the folder anymore). http://download.geofabrik.de/asia/israel-and-palestine-latest.osm.bz2
  2. I'm working with Mac OSX 10.11.4.

The error - /osm/node_modules/osrm-isochrone/node_modules/@turf/isolines/conrec.js:380 temp1 = Math.min(d[i][j], d[i][j + 1]); ^

TypeError: Cannot read property '24' of undefined at Conrec.contour (/Users/user/Downloads/osm/node_modules/osrm-isochrone/node_modules/@turf/isolines/conrec.js:380:36) at module.exports (/Users/user/Downloads/osm/node_modules/osrm-isochrone/node_modules/@turf/isolines/index.js:80:7) at draw (/Users/user/Downloads/osm/node_modules/osrm-isochrone/index.js:20:20) at /Users/user/Downloads/osm/node_modules/osrm-isochrone/index.js:74:31

Appreciate the help! Tomer.

tomershay avatar Dec 29 '16 19:12 tomershay

@tm-tomers have you found a solution?

toooni avatar Feb 18 '17 14:02 toooni

@toooni, thanks for reaching out. I didn't update here as I didn't know if this repo is still active or not. Actually, I found a partial solution. It seems that the error is caused because of the following line in index.js: var result = self.draw(destinations);

To my understanding, this line should be the one drawing the isochrones.

I didn't fully follow up on the reason to this error, as my requirement was a bit different than the original purpose of this open source - I needed the isochrone as a set of points (the polygon itself), so therefore I didn't need the drawing part anyway, so I just commented that out.

Hope this information will help you moving forward, good luck :) Tomer.

tomershay avatar Feb 18 '17 16:02 tomershay

@tm-tomers perfect! I do not need draw either. Now it seems to work! Thank you very much.

toooni avatar Feb 19 '17 04:02 toooni

Glad to hear that, good luck :)

tomershay avatar Feb 19 '17 06:02 tomershay