Skip to content

Error (still) when using PROJJSON or proj4.defs for Web Mercator EPSG:3857 #548

@algil

Description

@algil

The ellipsoidal version of Mercator is used instead of spherical.

I was about to report this but just saw the fix in the latest version. However it still doesn't work for PROJJSON , nor for WKT or WKT2 if Web Mercator defined via proj4.defs, because checkMercator() doesn't get called in these cases. Function parse() needs fixing.

Something like the following should do it:

  function parse(code) {
    let out; 
    if (testObj(code)) {     // its a string
      if (testDef(code)) {
        out = defs[code];
      } else if (testWKT(code)) {
        out = wkt(code);
        var maybeProjStr = checkProjStr(out);
        if (maybeProjStr) {
          out = projStr(maybeProjStr);
        }
      } else if (testProj(code)) {
        out = projStr(code);
      }
    } else {             // its an object
      out = ('projName' in code) ? code : wkt(code);
    } 
    return out && checkMercator(out) ? defs['EPSG:3857'] : out;
  }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions