PROJ.4 库和 OSGB36
希望你一切都好
我正在尝试使用 proj.4 库将纬度/经度坐标转换为 OSGB36 x 和 y。
还有其他人成功地做到了这一点吗?我需要填充 srcPrj4String 和 destPrj4String 变量,例如
string srcPrj4String = "+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs";
字符串 destPrj4String = "+proj=utm +zone=11 +ellps=GRS80 +datum=NAD83 +units=m";
但我无法弄清楚 OSGB36 的 destPrj4String 应该是什么 - 我知道数据应该是 +datum=OSGB36,但我尝试的一切都不起作用
有什么想法吗?
非常感
谢莱迪
hope you are well
I am trying to convert lat/long coordinates to OSGB36 x and y using the proj.4 library.
Has anyone else successfully done this? I need to fill the srcPrj4String and destPrj4String variables, e.g.
string srcPrj4String = "+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs";
string destPrj4String = "+proj=utm +zone=11 +ellps=GRS80 +datum=NAD83 +units=m";
but I can't figure out the what the destPrj4String should be with OSGB36 - i know the datum should be +datum=OSGB36, but everything I try, doesn't work
Any ideas?
Many thanks in advance
leddy
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
谷歌搜索发现这个来自曼彻斯特大学地球学家约翰史蒂文森博士科学学术——如果有人做对了,谁应该做对。这是一个引用。
问题是转向 OSGB36 需要投影和
数据转换。在 2007 年 10 月之前,proj 仅携带
出投影,从而导致较大的偏移。你可以检查
如果您通过运行“proj -v”或查看您的
epsg 文件:
新版本有 +datum=OSGB36。
如果您有旧版本,可以通过将该行替换为来更正它:
复杂的是 OSGB36 是 相对于 GPS 略有失真
投影(例如 WGS84 和 ETRS89)。这个偏移量很小,并且
仅对于更高精度的测量很重要。很多搜索关于
OSGB36 偏移量会显示与此相关的页面。如果你想
也弥补这一点
您可以下载 nadgrid 文件并使用它 。对于我的数据,这移动了
点相差约 1 m。
Googling turns up this from Dr John Stevenson, a Manchester University Earth Science academic - who should get it right if anyone does. Here's a quote.
The problem was that going to OSGB36 requires both a projection and a
datum conversion. Prior to October 2007, proj was only carrying
out the projection, thus resulting in the large offset. You can check
if you have the new version by running 'proj -v' or by looking at your
epsg file:
The new versions have +datum=OSGB36.
If you have an old version, you can correct it by replacing the line with:
A complication is that OSGB36 is slightly distorted with respect to GPS
projections (such as WGS84 and ETRS89). This offset is small, and
is only important for higher precision surveying. Many searches about
OSGB36 offsets bring up pages relating to this. If you want to
compensate for this too,
you can download a nadgrid file and use it. For my data, this moved
the points by about 1 m.
明白了:
干杯!
got it:
cheers!
spatialreference.org 上的 EPSG:27700 提供了用于定义此值的各种字符串,包括 proj4 的字符串。
以下是使用 proj4 绑定的 ruby 中的示例代码:
输出:
http://www.openstreetmap.org/?mlat=51.52237&mlon=-0.10322&zoom=16
转换为:
http://streetmap.co.uk/grid/531691_182089_106
所以现在可以正常工作了。最初我只是尝试使用“destPrj”字符串,并调用“forward”方法,但这拒绝进行数据转换,导致所有内容都超出了 100m。似乎有必要使用“srcPrj”字符串和“transform”方法来进行数据转换。
另请参阅我的博客文章:用于从 WGS84 转换为英国地形测量局坐标系的 Ruby 代码? 其中包括用于执行相同操作的纯 Ruby 版本(不是 proj4)
EPSG:27700 on spatialreference.org gives various strings for defining this, including one for proj4.
Here is example code in ruby using the proj4 bindings :
The output:
http://www.openstreetmap.org/?mlat=51.52237&mlon=-0.10322&zoom=16
Converts to:
http://streetmap.co.uk/grid/531691_182089_106
So this is working accurately now. Originally I was trying just the 'destPrj' string, and calling the 'forward' method, but this refused to do the datum conversion, resulting everything being 100m out. It seemed to be necessary to use the 'srcPrj' string and the 'transform' method, to get the datum conversion happening.
See also my blog post: Ruby code for converting to UK Ordnance Survey coordinate systems from WGS84? which includes a pure ruby version (not proj4) for doing the same