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

Reproject to CRS84 #8

Open
tordans opened this issue Feb 16, 2024 · 2 comments
Open

Reproject to CRS84 #8

tordans opened this issue Feb 16, 2024 · 2 comments

Comments

@tordans
Copy link

tordans commented Feb 16, 2024

One constant issue I have with GeoJSON is, that people export whatever Projection they are currently using in QGIS and the resulting file does not conform to the specification which is explicit in requiring urn:ogc:def:crs:OGC::CRS84

https://stevage.github.io/geojson-spec/#section-4

image

It would be awesome, if the validator could fix this automatically.

@chrieke
Copy link
Owner

chrieke commented Feb 16, 2024

Hm yeah, difficult topic. As you said, GeoJSON should be always latlon coordinates, but as other coordinate systems were allowed in an earlier specification, using GeoJSON like that is still not explicitely invalid.

Unfortunately afaik there is no consistent system how the coordinate system string is defined, I have seen other definitions involving any form of 1984, 4326 etc. that can be read by custom tools.
So yeah we could add an optional function to reproject it, but:

  • It would probably fail to recognize some custom definition strings
  • It probably needs to stay optional and can't be applied automatically (to avoid errors with the above case and unintended applications by the user.

But yeah I can imagine an additional function and in the webapp a button popup "Hey your GeoJSON seems to use a different crs, do you want to transform it 4326?"

Will think about it, thanks!

@tordans
Copy link
Author

tordans commented Apr 9, 2024

It sounds like https://github.com/perliedman/reproject?tab=readme-ov-file#towgs84geojson-from-crss might be something that helps here.

For a fully automatic "convert almost any common projection to lat/lon", try this:

var epsg = require('epsg');
toWgs84(geojson, undefined, epsg);

But I never used this library, before…

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