perliedman / ocad2geojson

JavaScript OCAD file reader and exporter for GeoJSON, SVG and Mapbox Style Spec
https://www.liedman.net/ocad2geojson/
GNU Affero General Public License v3.0
39 stars 4 forks source link

CRS of exported GeoJSON i CLI tool #17

Closed perliedman closed 2 years ago

perliedman commented 4 years ago

The coordinate transformation in the CLI utility is very much a hack as it is now, and only sort-of-works unless the map is located where I live :disappointed:

Mainly three possibilities:

  1. let the exported GeoJSON be in whatever coordinate system it was drawn in - that is, don't try to reproject it to WGS84 latitude and longitudes. This leaves out the risk of converting incorrectly, but also has the downside that a lot of tools expect GeoJSON to be in WGS84 format (and the spec says it should be)
  2. make the user specify the coordinate system on the command line, which will make the data correct, but the user might not know this
  3. find out the correct coordinate system from the OCAD file: at least for some files, this is theoretically possible, although OCAD uses proprietary codes and not the official EPSG codes, so we would need to find the meaning of those codes

While I like 3, I have found no source for such a list, so I guess 2 is the best option, but the CLI tool should also probably support option 1 since it is sometimes desirable.

jmacura commented 4 years ago

Hi!

Ad 3) check out this repo: https://github.com/doppelmeter/OCAD-Grid-ID_to_EPSG It is also incorporated in @OpenOrienteering Mapper: https://github.com/OpenOrienteering/mapper/blob/master/src/fileformats/ocd_georef_fields.cpp

perliedman commented 4 years ago

Wow, that's fantastic! Thanks for the heads up, @jmacura !

perliedman commented 3 years ago

Since I rewrote the CLI tool it now uses option 2 above: exported CRS is the projection of the OCAD file. You can also extract the CRS name since ocad2geojson now knows about OCAD grid ids from the list linked above.

In the future, it should be possible to add an options to export: