您需要以您选择的语言访问 PROJ.4 投影库的接口。例如,在 R 中,它在 rgdal 包中:
这是 epsg:4326 中的一些点(1,1 到 2,2 度):
> pts
SpatialPoints:
coords.x1 coords.x2
[1,] 1 1
[2,] 2 2
Coordinate Reference System (CRS) arguments: +init=epsg:4326
瞧:
> spTransform(pts,CRS("+init=epsg:27700"))
SpatialPoints:
coords.x1 coords.x2
[1,] 734005.9 -5416918
[2,] 845270.7 -5305999
Coordinate Reference System (CRS) arguments: +init=epsg:27700
Proj.4 文档在这里:
http://trac.osgeo.org/proj/
由于这是 OSGB,因此英国可能是一个更好的例子:这是伦敦市中心的一个点:
> pts = SpatialPoints(cbind(-0.109863,51.460852),proj4string=CRS("+init=epsg:4326"))
> spTransform(pts,CRS("+init=epsg:27700"))SpatialPoints:
coords.x1 coords.x2
[1,] 531407.1 175235.8
Coordinate Reference System (CRS) arguments: +init=epsg:27700
+proj=tmerc +lat_0=49 +lon_0=-2 +k=0.9996012717 +x_0=400000
+y_0=-100000 +ellps=airy +datum=OSGB36 +units=m +no_defs
+towgs84=446.448,-125.157,542.060,0.1502,0.2470,0.8421,-20.4894