2011-07-27 59 views
1

我需要编写一个函数,该函数可以将由latitude/longitue定义的某个位置投影到地图上的x,y坐标(图像)。lambert 2008投影

该地图本身似乎使用“比利时朗伯”作为投影类型。

我发现了一些有关此投影及其配置的官方信息:http://ign.be/FR/FR2-1-4.shtmhttp://ign.be/Common/Lambert2008/Transformation_Geographic_Lambert_FR.pdf(法文,我会翻译,如果需要)。

基本上,我得出的结论是,使用某些库会更容易一些(尽管这不是要求)。经过一番研究,看来OpenMap应该能够完成这项工作。

所以,这里是我走到这一步:

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); 
} 

(知道我的GIF是1000×1000)的LamberConformal构造

的JavaDoc: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

我想我没有配置它的权利:一些点应该在地图上,xxx,给出这个结果:

x=-1766051.0; y=-1.6355546E7; 

给人以“中心点”(?)作为参数给出

x=500.0; y=500.0; 

(在地图的中间,这看起来不错)

任何人都熟悉,或者能够从链接图中的配置?

编辑:

试图用这种替代方法,从最后一行:

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

而不是更好。

回答

0

对于那些有兴趣的人,这里是我如何让它工作。

这是一张比利时地图(似乎使用Lambert 72或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); 

规模可以计算这种方式:

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); 

两个点是任意点(如NW和SE越好),而您知道这两个地理坐标,并在那里,这是投影在地图。

我还必须找到地图中心的地理坐标。

在地图上的点的位置然后可以找到这样:

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