Support Shapefile .prj file
I'm interested to know what it would take to support reading Shapefile's .prj files. I had proposed this at shp2json, but maybe it belongs here.
Then one could do:
shp2json foo.shp | reproject --prj foo.prj > foo.geojson
From my understanding, a Shape file's .prj will contain a WKT definition of the projection. Also, it looks like Proj4.js can parse WKT, although I have never tried it. So, I think a great solution would be to make it possible to supply files as definitions of from/to CRS, instead of just accepting EPSG codes.
I would envision something like adding --from-crs-file and --to-crs-file to handle this. Does that make sense to you?
Thinking about this further, I added a small change that allows --from and --to to not only be CRS identifiers, but also actual CRS definitions.
I think this should solve your use case by using it as follows:
shp2json foo.shp | reproject --from $(cat foo.prj) --to=epsg:4326 --use-epsg-io > foo.geojson
I haven't tested exactly this, since shp2json doesn't work on the Windows machine I'm currently on, but that should be a detail.
Give it a spin and see if it works for you!
Thanks, that does work. IMHO it would be simpler, more intuitive to have a command line option that directly supports a filename, rather than relying on the cat workaround.
Agreed, that might be good. So maybe support --from-crs-file and --to-crs-file anyway, but let them rely on the same code.