Menu

Usage of LambertConformalConic to create specific Lambert-93 converter

Help
2022-09-06
2022-09-07
  • Mark Lorenz

    Mark Lorenz - 2022-09-06

    Hi Charles,

    first: Thank you so much for your library. I used it several times in my projects and even already ported some parts of it into Dart.

    Currently I want to create a WGS84 LatLon converter from/into Lambert-93 and several other specific Lambert projections.

    When I read some sources like the French Wikipedia on that (https://fr.wikipedia.org/wiki/Projection_conique_conforme_de_Lambert) I came to a problem with the definitions.

    In your code, one needs following parameters (next to rotation ellipsoid definition, which I remove here for simplicity):

    stdlat1, stdlat2 -> standard parallels
    k1 -> scale of std parallels
    
    lon0 -> central median long
    lat/lon -> actual position
    

    However, reading the source given above, the definition of, for instance Lambert-93, are always given like this:

    Projection:     λ0      φ0      φ1      φ2      X0          Y0
    Lambert-93:     3°E     46.5°   44°     49°     700 000 m   6 600 000 m 
    

    That means: We have

    λ0 == lon0
    φ1 == stdlat1
    φ2 == stdlat2
    

    But we are lacking of the scale k1 but get a φ0 instead. On top, there is a X0/Y0 which is not also not clear to me.

    So, do you know how to handle this data with your code?

    Is it possible to use your code to achieve my goal creating a Lambert-93 converter? For example, do I need to convert φ0 into k1 in any way?

    Do you know what the X/Y coordinates are for?

    Again, thanks a lot, sir for your great and impressive work!
    Greets, Mark

     

    Last edit: Mark Lorenz 2022-09-06
  • Charles Karney

    Charles Karney - 2022-09-06

    The coordinates are shifted so that the projected coordinates at phi0/lam0 are X0/Y0. The example examples/example-LambertConformalConic.cpp shows how to handle this. This example is for the Pennsylvania South coordinate system. However the French projection is similar. Compare

    https://www.spatialreference.org/ref/epsg/3364/html/
    https://www.spatialreference.org/ref/epsg/2154/html/

     
  • Mark Lorenz

    Mark Lorenz - 2022-09-06

    Wow, that was quick! Thanks a lot!

    I missed that example. So, the two key points are:

    1. You do the Forward() operation twice: One for the point transformation using the given X0/Y0 points and then the actual operation, correct? What's interesting about this, is that you use the lon0 twice in the parameters. Could you explain this point please?
    2. k1 equals 1. Is that always the case with these kinds of definitions?
     

    Last edit: Mark Lorenz 2022-09-06
  • Charles Karney

    Charles Karney - 2022-09-06
    1. Better to say I do the Forward() operation 1+n times. 1 as part of construction and n for the n points to be projected. Because of the simple way lon0 enters into this projection, I elected not to incorporate it as part of the construction. Instead you specify it on each call to Forward and Reverse.
    2. Usually k1 = 1 if there are two distinct standard parallels. I hesitate to say "always".
     

    Last edit: Charles Karney 2022-09-06
  • Mark Lorenz

    Mark Lorenz - 2022-09-06

    Understood. Thank you so much, sir!

     
  • Mark Lorenz

    Mark Lorenz - 2022-09-07

    Hi,

    thanks. For all projects using 2 standard parallels, my code works greatly now!

    I have another question. I was checking EPGS 27564 (only one standard parallel)

    https://www.spatialreference.org/ref/epsg/27564/html/

    There we have given a latitudeOfOrigin and a scaleFactor (and a centralMeridian == 0.0). So I require the first constructor, right?

    So I tried the same algorithm as you did in your PA example (pseudo code):

    var epsg = [
          centralMeridian: 0.0,
          latitudeOfOrigin: 46.85,
          scaleFactor: 0.99994471,
          falseEasting: 234.358,
          falseNorthing: 185861.369
    ];
    
    var lambertObject = LambertConformalConic (
        stdLat1: epsg.latitudeOfOrigin,
        k0: epsg.scaleFactor
    );
    
    var transformation = lambertObject.Forward(
       lon0: epsg.centralMeridian, // <-- is 0.0
       lat: epsg.latitudeOfOrigin,
       lon: epsg.centralMeridian
    );
    
    var x0 = transformation.x - epsg.falseEasting;
    var y0 = transformation.y - epsg.falseNorthing;
    
    var convertedLambert = lambertObject.Forward(
        epsg.centralMeridian,
        myLat,
        myLon
    );
    
    return (convertedLambert.x - x0, convertedLambert.y - y0)
    

    Forward and Reverse operation return my original latLon data. So, the calculation seems to be consistent in both directions. However, when I compare with

    https://epsg.io/transform#s_srs=4326&t_srs=27564&x=0.3770639&y=43.2972250

    I get other values for Forward:

    My values:    X:   30887.564017280973 Y: -209122.8698659375
    Their values: X: -158783.19298601284  Y:  313462.3282156822
    

    (same for any other format using only one standard parallel. I am not getting the same result)

    So, I guess, I am wrong with simply using your transformation code directly for the one parallel case, right?

    Could you please tell me, what I need to change here? Is it correct to work with the centralMeridian == 0for lon0 and latitudeOfOrigin for stdLat1?

    Thanks again in advance!
    Greets, Mark

     

    Last edit: Mark Lorenz 2022-09-07
  • Charles Karney

    Charles Karney - 2022-09-07

    There are a number of things going on with this projection

    • SPHEROID is not WGS84 but Clarke 1880
    • PRIMEM is not Greenwich but Paris
    • UNIT is not degrees by grad
    • TOWGS84 is non-zero

    Presumably the central_medidian is relative to Paris? GeographicLib
    doesn't know how to map a point on WGS84 to this spheroid+datum. I
    can't help you with this; PROJ would be the tool I would look into
    using.

    Once you've mapped you point of interest to a latitude+longitude on this
    datum, then you can use GeographicLib::LambertConformalConic to
    project the point. (Be sure to special the Clarke 1880 ellipsoid in the
    constructor.)

     
  • Mark Lorenz

    Mark Lorenz - 2022-09-07

    Ok, thank you again!

     

Anonymous
Anonymous

Add attachments
Cancel