gdal3.x差异化分享

一、proj6以上版本差异

1、proj6以上版本在进行坐标转换时需要proj.db文件,而proj6只能通过在环境变量中设置PROJ_LIB为.db文件的 目录才能使用该数据库,所以不推荐使用proj6.而使用proj7以上时,proj.db和proj.dll的相对位置如下:

可以通过osr.SetPROJSearchPath,osr.SetPROJSearchPaths来设置proj的搜索路径。

2、坐标转换类CoordinateTransformation ,使用TransformPoint输出点的经纬度与输入点的坐标轴相反

CoordinateTransformation ct = new CoordinateTransformation(srf, srt);

ct.TransformPoint(point);

可以通过设置坐标轴策略来避免这个问题。

SpatialReference srcSR = new SpatialReference(wkt);
SpatialReference dstSR = new SpatialReference();

srcSR.SetAxisMappingStrategy(osr.OAMS_TRADITIONAL_GIS_ORDER);
dstSR.SetAxisMappingStrategy(osr.OAMS_TRADITIONAL_GIS_ORDER);

官方文档解释:

Why is the axis ordering in PROJ not consistent?

PROJ respects the axis ordering as it was defined by the authority in charge of a given coordinate reference system. This is in accordance to the ISO19111 standard [ISO19111]. Unfortunately most GIS software on the market doesn’t follow this standard. Before version 6, PROJ did not respect the standard either. This causes some problems while the rest of the industry conforms to the standard. PROJ intends to spearhead this effort, hopefully setting a good example for the rest of the geospatial industry.

Customarily in GIS the first component in a coordinate tuple has been aligned with the east/west direction and the second component with the north/south direction. For many coordinate reference systems this is also what is defined by the authority. There are however exceptions, especially when dealing with coordinate systems that don’t align with the cardinal directions of a compass. For example it is not obvious which coordinate component aligns to which axis in a skewed coordinate system with a 45 degrees angle against the north direction. Similarly, a geocentric cartesian coordinate system usually has the z-component aligned with the rotational axis of the earth and hence the axis points towards north. Both cases are incompatible with the convention of always having the x-component be the east/west axis, the y-component the north/south axis and the z-component the up/down axis.

In most cases coordinate reference systems with geodetic coordinates expect the input ordered as latitude/longitude (typically with the EPSG dataset), however, internally PROJ expects an longitude/latitude ordering for all projections. This is generally hidden for users but in a few cases it is exposed at the surface level of PROJ, most prominently in the proj utility which expects longitude/latitude ordering of input date (unless proj-r is used).

In case of doubt about the axis order of a specific CRS projinfo is able to provide an answer. Simply look up the CRS and examine the axis specification of the Well-Known Text output:

  • 21
    点赞
  • 21
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值