如何将纬度/经度(以度为单位)转换为 BBOX,其中 SRS=EPSG:27700

发布于 2024-10-08 03:43:35 字数 731 浏览 0 评论 0原文

有人知道如何转换纬度、经度以度数来定义 BBOX 其中 SRS=EPSG:27700 吗?

我正在尝试使用如下 URL 调用 WMS 服务(不是真正的链接): http://mysecretmappingserver.com/wms?user=myuser&pwd=mypassword&VERSION=1.1.1&REQUEST=GetMap&LAYERS =ap25cm&STYLES=&SRS=EPSG:27700&BBOX=229096,231675,229296,231875&width=400&height=400

任何语言都可以; C# 更好。

Spacedman 一直在试图帮助我,但我似乎无法让 Proj4Net 为我工作 - 我确信,我所有 - 但如果有人知道 Proj4Net 或所涉及的数学,那可能变得更好...

Anyone know how to convert latitude, longitude in degrees to define a BBOX where SRS=EPSG:27700?

I am trying to call a WMS service with a URL like following (not a real link):
http://mysecretmappingserver.com/wms?user=myuser&pwd=mypassword&VERSION=1.1.1&REQUEST=GetMap&LAYERS=ap25cm&STYLES=&SRS=EPSG:27700&BBOX=229096,231675,229296,231875&width=400&height=400

Any language would be fine; C# preferable.

Spacedman has been trying to help me, but I can't seem to get Proj4Net to work for me - all me, I'm sure - but if someone knows either Proj4Net or the math involved, that might be better...

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

回首观望 2024-10-15 03:43:35

您需要使用您选择的语言的 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 文档在这里:

这是 osgeo.org/proj/" rel="nofollow">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 

You need an interface to the PROJ.4 projections library in your language of choice. In R, for example, its in the rgdal package:

Here's some points (1,1 to 2,2 degrees) in epsg:4326:

> pts
SpatialPoints:
     coords.x1 coords.x2
[1,]         1         1
[2,]         2         2
Coordinate Reference System (CRS) arguments: +init=epsg:4326 

and voila:

> 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 docs here:

http://trac.osgeo.org/proj/

Since this is OSGB, probably a better example would be in the UK: here's a point in central london:

> 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 
書生途 2024-10-15 03:43:35

我推荐 ogr2ogr,它可以在投影之间进行转换。我已将它安装在我的 Mac 上,并且可以绑定到 Python 和许多其他语言。您也可以在命令行上使用它。主页是http://www.gdal.org/ogr2ogr.html

I recommend ogr2ogr, which among other things can convert between projections. I have it installed on my Mac, and there are binding e.g. to Python and many other languages. You can also use it on the commandline. Homepage is http://www.gdal.org/ogr2ogr.html

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文