mapbox / osrm-isochrone

Generate drivetime isochrones from OpenStreetMap data using OSRM
MIT License
126 stars 50 forks source link

TypeError: Cannot read property '24' of undefined #21

Open tomershay opened 7 years ago

tomershay commented 7 years ago

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.

toooni commented 7 years ago

@tm-tomers have you found a solution?

tomershay commented 7 years ago

@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.

toooni commented 7 years ago

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

tomershay commented 7 years ago

Glad to hear that, good luck :)