mapbox / geobuf

A compact binary encoding for geographic data.
ISC License
967 stars 84 forks source link

Fix shp2geobuf #106

Closed metacollin closed 4 years ago

metacollin commented 5 years ago

Hi, I am not very comfortable with javascript so to be perfectly honest, this rewrite is probably pretty bad in terms of code quality. This pull request is more for other people to find, or perhaps the original authors to take implementation ideas from, rather than being merged in actuality.

Anyway, shp2geobuf doesn't work at all. It can't seem to open the stream at all, at least on POSIX systems. Beyond that, it will only import a .shp file and ignore the associated .dbf file, if it exists.

This is an attempt at both fixing shp2geobuf, and adding some fairly important functionality. It can find .dbf files automatically as long as they have the same basename as the .shp file and are located in the same directory. And the user may also give a path to a .dbf file explicitly as a second argument. And of course, it will still work with a .shp file by itself.

I also updated the documentation to reflect this, as well as the ability to pipe data to geobuf2json and json2geobuf. Neither of these commands seem to work anymore on POSIX systems if you specify a file path, but they do still work if you have them read from stdin.

Again, this code probably sucks so I don't expect anyone to actually merge this in, but if anyone who actually knows what they're doing in javascript wants to use/adapt/base their implementation on this code, by all means. I waive all claim of copyright on any work included in this pull request.

Thanks!

mourner commented 4 years ago

Superceded by #115