Search code examples
geolocationmap-projectionsopenmap

lambert 2008 projection


I need to write a function that can project some location defined by latitude/longitue to x,y coordinates on a map (image).

The map itself seems to be using "belgian Lambert" as projection type.

I found some official information about this projection and its configuration : http://ign.be/FR/FR2-1-4.shtm and http://ign.be/Common/Lambert2008/Transformation_Geographic_Lambert_FR.pdf (in french, I'll translate if needed).

Basically, I came to the conclusion that it would be easier to use some library (although that's not a requirement here). After some research, it seems that OpenMap should be able to do the work.

So, here is what I got so far:

private Point mapCoordinatesToPoint(LatLonPoint latLonPoint) {
    LatLonPoint centerLatLonPoint = new LatLonPoint(50.797815, 4.3592158333333333333333333333333);
    Proj proj = new LambertConformal(centerLatLonPoint, 1, 1000, 1000, 4.3592158333333333333333333333333, 49.833333333333333333333333333333, 51.166666666666666666666666666667, 50.797815, 649328.0, 665262.0, Ellipsoid.GRS_1980);
    return proj.forward(latLonPoint);
}

(knowing that my gif is 1000x1000)

JavaDoc for LamberConformal constructor: http://openmap.bbn.com/doc/api/com/bbn/openmap/proj/LambertConformal.html#LambertConformal%28com.bbn.openmap.LatLonPoint,%20float,%20int,%20int,%20double,%20double,%20double,%20double,%20double,%20double,%20com.bbn.openmap.proj.Ellipsoid%29

I guess I didn't configure it right: some point that should be on the map, xxx, gives this result:

x=-1766051.0; y=-1.6355546E7;

Giving the "center point" (?) as parameter gives

x=500.0; y=500.0;

(middle of the map, which looks ok)

Anyone familiar with this, or able to figure the configuration from the links?

EDIT:

tried replacing last line from method with this:

    return proj.forward(latLonPoint.getLatitude(), latLonPoint.getLongitude(), new Point(), false);

but not better.


Solution

  • For those interested, here is how I did let it work.

    This is for a map of Belgium (seems to be using either Lambert 72 or 2008).

        Proj proj = new LambertConformal(centerLatLonPoint, scale, 1776, 1468,
                4.3592158333333333333333333333333, //centralMeridian
                49.833333333333333333333333333333, //lambert_sp_one
                51.166666666666666666666666666667, //lambert_sp_two
                50.797815, //referenceLatitude
                649328.0, //falseEasting
                665262.0, //falseNorthing
                Ellipsoid.GRS_1980);
    

    Scale can be calculating this way:

        LatLonPoint dePanneLatLonPoint = new LatLonPoint(51.0975f, 2.5855f);
        Point dePannePoint = new Point(27, 313);
    
        LatLonPoint mussonLatLonPoint = new LatLonPoint(49.5567f, 5.7106f);
        Point mussonPoint = new Point(1464, 1426);
    
        float scale = proj.getScale(dePanneLatLonPoint, mussonLatLonPoint, dePannePoint, mussonPoint);
    

    The two points being arbitrary points (as nw and se as possible) for which you know both the geographical coordinates and where this is projected on the map.

    I also had to find the geographical coordinates of the center of the map.

    The location of a point on the map can then be found this way:

         Point point = proj.forward(latitude, longitude, new Point(), false);