Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: ENOENT: no such file or directory, open '[...]/data/N44E001.hgt' #16

Open
kozlown opened this issue May 10, 2017 · 6 comments
Open

Comments

@kozlown
Copy link

kozlown commented May 10, 2017

Hi, and first of all great work for this module 👍
It looks like SyncTileSet is not waiting the end of file writing before calling callback, I got the error bellow, though after a while I got the specified file in my data directory at absolute path specified in the error. My code runs with values which lead to the creation of about 40 .hgt files. By the way when I execute it a second time everything is ok because .hgt files are already in data directory.

{ Error: ENOENT: no such file or directory, open '[...]/data/N44E001.hgt'
at Error (native)
at Object.fs.openSync (fs.js:640:18)
at new Hgt (/var/www/mnp-project/api/node_modules/node-hgt/src/hgt.js:7:17)
at /var/www/mnp-project/api/node_modules/node-hgt/src/load-tile.js:28:35
at /var/www/mnp-project/api/node_modules/node-hgt/src/imagico.js:45:9
at tryCallOne (/var/www/mnp-project/api/node_modules/promise/lib/core.js:37:12)
at /var/www/mnp-project/api/node_modules/promise/lib/core.js:123:15
at flush (/var/www/mnp-project/api/node_modules/asap/raw.js:50:29)
at _combinedTickCallback (internal/process/next_tick.js:67:7)
at process._tickDomainCallback (internal/process/next_tick.js:122:9)
errno: -2,
code: 'ENOENT',
syscall: 'open',
path: '[...]/data/N44E001.hgt' }

my code :

const tileset = new SyncTileSet(`${__dirname}/data/`, [this.minLat, this.minLng], [this.maxLat, this.maxLng], (err) => {
    if (err) {
        reject(err)
        return
    }
    _.each(this.coordinates, (coordinate) => {
        const lat = coordinate[1]
        const lng = coordinate[0]
        // get new elevation and set it
        const elevation = tileset.getElevation([lat, lng])
        coordinate[2] = elevation
    })
    resolve('ok')
})
@perliedman
Copy link
Owner

Hi!
Interesting, it's been a looong time since I worked on this project, so hard to say for sure without diving into the code, but it sounds like this might be related to #13. I'll try to find the time to have a closer look!

@kozlown
Copy link
Author

kozlown commented May 11, 2017

Ok no problem anyway i cloned the node-hgt into my project instead of installing with npm, I made some changes, I used geojson-elevation (it fixed the error above) and I had another error about zip unlinking (file not found) so I made a quick modification to imagico.js, replacing this line :

fs.unlinkSync(tempPath);

by :

if (fs.existsSync(tempPath)) {
    fs.unlinkSync(tempPath);
}

It works pretty well in my case now.

@carles3
Copy link

carles3 commented May 23, 2017

Hi, I am using osm-slope tool, you have done a great work, thanks you.

I have the same error using osm-slope (node-hgt).

**events.js:141
throw er; // Unhandled 'error' event

Error: ENOENT: no such file or directory, open 'data/N40E000.hgt'
at Error (native)**

'data/N40E000.hgt' --> Depending on wich map I am using.

Is there any solution ? Can I download all .hgt file on my computer and search directly from there?

Thanks for your time.

@perliedman
Copy link
Owner

@carles3 hi, great to hear that you're finding the module useful!

I can't say for certain, but I would suspect it will work if you already have the hgt file in the correct location, since it's most likely some kind of race when getting/unpacking the ZIP file.

@carles3
Copy link

carles3 commented May 23, 2017

I have already the file .hgt but the error is the same.

node index.js [--cache-dir <DIR>] <IN>; <OUT>;

--cache-dir --> node_modules/node-hgt/test/data ?
The .hgt file is suposed to be there, am I wright? I have copied the .hgt file in this directory.

@perliedman
Copy link
Owner

@carles3 not sure then, sounds very weird that you would get "no such file or directory" if the file is there. I would recommend stepping through the code to actually see where it's looking and why it goes wrong.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants