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

proj4 fails for WGS84 WKT string starting with GEOGCRS #370

Open
kylebarron opened this issue Nov 25, 2020 · 1 comment
Open

proj4 fails for WGS84 WKT string starting with GEOGCRS #370

kylebarron opened this issue Nov 25, 2020 · 1 comment

Comments

@kylebarron
Copy link

This file has the following WKT CRS string:

> ogrinfo countries.fgb countries -so
Layer SRS WKT:
GEOGCRS["WGS 84",
    DATUM["World Geodetic System 1984",
        ELLIPSOID["WGS 84",6378137,298.257223563,
            LENGTHUNIT["metre",1]]],
    PRIMEM["Greenwich",0,
        ANGLEUNIT["degree",0.0174532925199433]],
    CS[ellipsoidal,2],
        AXIS["geodetic latitude (Lat)",north,
            ORDER[1],
            ANGLEUNIT["degree",0.0174532925199433]],
        AXIS["geodetic longitude (Lon)",east,
            ORDER[2],
            ANGLEUNIT["degree",0.0174532925199433]],
    USAGE[
        SCOPE["unknown"],
        AREA["World"],
        BBOX[-90,-180,90,180]],
    ID["EPSG",4326]]

However this fails to parse using proj4.js:

var proj4 = require('proj4');
var wkt = `GEOGCRS["WGS 84",
    DATUM["World Geodetic System 1984",
        ELLIPSOID["WGS 84",6378137,298.257223563,
            LENGTHUNIT["metre",1]]],
    PRIMEM["Greenwich",0,
        ANGLEUNIT["degree",0.0174532925199433]],
    CS[ellipsoidal,2],
        AXIS["geodetic latitude (Lat)",north,
            ORDER[1],
            ANGLEUNIT["degree",0.0174532925199433]],
        AXIS["geodetic longitude (Lon)",east,
            ORDER[2],
            ANGLEUNIT["degree",0.0174532925199433]],
    USAGE[
        SCOPE["unknown"],
        AREA["World"],
        BBOX[-90,-180,90,180]],
    ID["EPSG",4326]]
`;
var projection = proj4(wkt, 'WGS84');

the proj4 call does not return a value, and instead just prints the input string

string: 'GEOGCRS["WGS 84",\n' +
  '    DATUM["World Geodetic System 1984",\n' +
  '        ELLIPSOID["WGS 84",6378137,298.257223563,\n' +
  '            LENGTHUNIT["metre",1]]],\n' +
  '    PRIMEM["Greenwich",0,\n' +
  '        ANGLEUNIT["degree",0.0174532925199433]],\n' +
  '    CS[ellipsoidal,2],\n' +
  '        AXIS["geodetic latitude (Lat)",north,\n' +
  '            ORDER[1],\n' +
  '            ANGLEUNIT["degree",0.0174532925199433]],\n' +
  '        AXIS["geodetic longitude (Lon)",east,\n' +
  '            ORDER[2],\n' +
  '            ANGLEUNIT["degree",0.0174532925199433]],\n' +
  '    USAGE[\n' +
  '        SCOPE["unknown"],\n' +
  '        AREA["World"],\n' +
  '        BBOX[-90,-180,90,180]],\n' +
  '    ID["EPSG",4326]]\n'

I hadn't seen the GEOGCRS prefix before, so I changed GEOGCRS -> GEOGCS and it worked. Is GEOGCRS incorrect here? It seems to be defined in the WKT CRS spec. Is it a bug in proj4.js then?

@ahocevar
Copy link
Member

This is something that could be fixed in https://github.com/proj4js/wkt-parser. Would you be able to provide a pull request?

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