简体   繁体   English

使用 OGR 将 GML 转换为 GeoJSON 会导致坐标偏移

[英]Converting GML to GeoJSON using OGR results in a coordinate shift

I am attempting to convert the Index polygons spatial data (INSPIRE)s that the UK Land Registry provides free of charge.我正在尝试转换英国土地注册处免费提供的索引多边形空间数据 (INSPIRE)。 They are provided in GML format and the one referred to in this question is available at this link .它们以 GML 格式提供,此问题中提到的格式可在此链接中找到。 A free account can be created to access the download.可以创建一个免费帐户来访问下载。

I have used the following command line syntax on Ubuntu 20 which is using the latest available release of GDAL v3.3.2:我在使用最新可用版本的 GDAL v3.3.2 的 Ubuntu 20 上使用了以下命令行语法:

ogr2ogr -f geojson -s_srs EPSG:27700 -t_srs epsg:4326 output.json Land_Registry_Cadastral_Parcels.gml

The release notes warn that some conversions can result in a coordinate shift of up to fifteen metres and that is what I am experiencing.发行说明警告说,某些转换可能导致高达 15 米的坐标偏移,这就是我所经历的。 However, when I attempt the conversion using the desktop QGIS product (it uses GDAL 3.4.1) it performs the conversion accurately.但是,当我尝试使用桌面 QGIS 产品(它使用 GDAL 3.4.1)进行转换时,它会准确地执行转换。 The image below shows the two conversions:下图显示了两种转换:

Screen shot of both conversions两种转换的屏幕截图

As I am not able to see the command that QGIS is performing is anyone able to tell me what I need to include in the command line directive?由于我无法看到 QGIS 正在执行的命令,是否有人能够告诉我我需要在命令行指令中包含什么?

After getting the above hint from Ian Turton I managed to put the following command together which seems to work:从 Ian Turton 得到上述提示后,我设法将以下命令放在一起,这似乎有效:

ogr2ogr -f geojson -s_srs "+proj=tmerc +lat_0=49 +lon_0=-2 +k=0.999601 +x_0=400000 +y_0=-100000 +ellps=airy +units=m +no_defs +nadgrids=./ostn02_ntv2.gsb" -t_srs EPSG:4326 output.json Land_Registry_Cadastral_Parcels.gml

It requires 'ostn02_ntv2.gsb' which can be download from https://www.ordnancesurvey.co.uk/documents/resources/OSTN15-NTv2.zip它需要“ostn02_ntv2.gsb”,可以从https://www.ordnancesurvey.co.uk/documents/resources/OSTN15-NTv2.zip下载

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM