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

ENAMETOOLONG - When converting large GeoJSON to Shapefile #33

Closed
robparkhill opened this issue Jul 25, 2018 · 3 comments
Closed

ENAMETOOLONG - When converting large GeoJSON to Shapefile #33

robparkhill opened this issue Jul 25, 2018 · 3 comments

Comments

@robparkhill
Copy link

Thanks for this awesome package. It works very well for thing things that I need it to do, except I have run into an issue, and am hopeful that I can get it resolved. Running on Windows, GDAL 2.1.3, released 2017/20/01.

This works no problem with all my GeoJSON:
var newShape = ogr2ogr(currjson).format('ESRI Shapefile').skipfailures().stream(); newShape.pipe(fs.createWriteStream(filename + '.zip'));

However, there are a couple of instances lately where it is failing and I am getting an ENAMETOOLONG error. At first I thought that it was something in the GeoJSON, so I cleaned a few files and it worked no problem, however today, there is no cleaning possible. (Other files had a ridiculous number of properties that were not important - whereas today's issue has a file with over 2250 coordinate pairs!).

I've spent the last few hours looking for solutions, and can't seem to get one that works. I've updated my code as follows:
let newShape = ogr2ogr(currjson) .format('ESRI Shapefile') .skipfailures() .stream(); let outputStream = fs.createWriteStream(filename + '.zip'); newShape.pipe(outputStream) newShape.on('error', function(){ console.log('Well thats messed up'); })

and the on-error doesn't fire, and I still get the ENAMETOOLONG error, and it is coming from the .stream() portion (as far as I can tell).

Any pointers would be much appreciated.

@wavded
Copy link
Owner

wavded commented Aug 2, 2018

Never have encountered that error, only lead I've found is that the file name created is literally too long for the underlying OS, is there any logic in your application that could be naming things too long? Also, if you have some sample code that can reproduce, that would help.

@robparkhill
Copy link
Author

Well, that's the thing. It works for most of the data. I have the GeoJSON stored in the DB, and I am just passing the data to ogr2ogr to convert to KML and Shape. If the GeoJSON package is large (over 1200 or so coordinate pairs) the temp file (or that is what I am coming to think) is too large of a name. It looks like there is a temp file created when making the shapes or KMLs, and that the naming/location of that (if the GeoJSON is large) causes this error.

Is there any way that I can pass in a temp directory for the code? (looks like it creates the folder and destroys it, and that it is appended to the location for the GDAL code. If not, I guess I will have to move the GDAL stuff to the root level, so that temp files can be longer.

@wavded
Copy link
Owner

wavded commented Feb 14, 2020

Closing due to age, reopen if issue persists.

@wavded wavded closed this as completed Feb 14, 2020
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

2 participants