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

Support GEOGCRS #19

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Support GEOGCRS #19

wants to merge 1 commit into from

Conversation

kylebarron
Copy link

Attempted fix for proj4js/proj4js#370. I don't know WKT very well, so looking forward to a review.

var parser = require('./wkt.build')
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 out = parser(wkt)
console.log(JSON.stringify(out))
{
  "type": "GEOGCRS",
  "name": "WGS 84",
  "DATUM": {
    "name": "World Geodetic System 1984",
    "ELLIPSOID": {
      "name": "WGS 84",
      "a": 6378137,
      "rf": 298.257223563,
      "LENGTHUNIT": { "metre": 1 }
    }
  },
  "PRIMEM": {
    "name": "greenwich",
    "convert": 0,
    "ANGLEUNIT": { "degree": 0.0174532925199433 }
  },
  "CS": { "ellipsoidal": 2 },
  "AXIS": [
    [
      "geodetic latitude (Lat)",
      "north",
      ["ORDER", 1],
      ["ANGLEUNIT", "degree", 0.0174532925199433]
    ],
    [
      "geodetic longitude (Lon)",
      "east",
      ["ORDER", 2],
      ["ANGLEUNIT", "degree", 0.0174532925199433]
    ]
  ],
  "USAGE": {
    "SCOPE": "unknown",
    "AREA": "World",
    "BBOX": { "-90": { "-180": { "90": 180 } } }
  },
  "ID": { "EPSG": 4326 },
  "projName": "longlat",
  "datumCode": "wgs84",
  "srsCode": "WGS 84"
}

@kylebarron
Copy link
Author

I tried to test this locally with proj4js but it didn't seem to fix the problem.

@kudlav
Copy link

kudlav commented Mar 7, 2023

GEOGCRS keyword needs to be added also into codeWords array in the proj4js/lib/parseCode.js:

var codeWords = ['PROJECTEDCRS', 'PROJCRS', 'GEOGCS','GEOCCS','PROJCS','LOCAL_CS', 'GEODCRS', 'GEODETICCRS', 'GEODETICDATUM', 'ENGCRS', 'ENGINEERINGCRS'];
function testWKT(code){
  return codeWords.some(function (word) {
    return code.indexOf(word) > -1;
  });
}

@kylebarron
Copy link
Author

kylebarron commented Mar 7, 2023

@kudlav I don't have the bandwidth right now to work on this PR; you're welcome to make a new one based off of this

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

Successfully merging this pull request may close these issues.

2 participants