麻辣GIS微信平台

更多 GIS 干货

微信关注不错过

QGIS字段计算器中$area和area函数的区别

在使用QGIS字段计算器的时候计算多边形面积的时候,发现会有两个函数,一个是$area,一个是area,仔细观察发现其计算出来的面积大小并不一致。那么这两个函数有什么区别呢?

$area 函数

详细写法

$area

先看官网解释:

Returns the area of the current feature. The area calculated by this function respects both the current project’s ellipsoid setting and area unit settings. For example, if an ellipsoid has been set for the project then the calculated area will be ellipsoidal, and if no ellipsoid is set then the calculated area will be planimetric.

$area 在计算面积的时候会先看当前项目的椭球的设置,如果设置了椭球,那么计算出来的面积就是椭球面积,如果没有设置椭球,那么计算出来的面积就是平面面积。

椭球设置方法如下:依次打开 工程 -- 工程属性

选择常规选项卡

area 函数

详细写法

area($geometry)

官网解释:

Returns the area of a geometry polygon object. Calculations are always planimetric in the Spatial Reference System (SRS) of this geometry, and the units of the returned area will match the units for the SRS. This differs from the calculations performed by the $area function, which will perform ellipsoidal calculations based on the project’s ellipsoid and area unit settings.

area 函数计算的面积是当前空间参考系中的平面面积,不会考虑椭球的设置,而且返回的面积单位和当前坐标系的单位一致。

测试

下面是小编做的测试:

  • mj2 是使用area($geometry)计算出来的面积。
  • area 是使用$area计算出来的面积,使用了一个EPSG 7030椭球。
  • area2 也是使用 $area 计算出来的面积,但没有设置椭球。

参考

  1. https://gis.stackexchange.com/questions/23355/calculating-polygon-areas-in-shapefile-using-qgis
  2. https://docs.qgis.org/3.28/en/docs/user_manual/expressions/functions_list.html

全部QGIS笔记

所有的GIS笔记查看这里------> QGIS 学习笔记汇总

相关阅读

麻辣GIS-Sailor

作者:

GIS爱好者,学GIS,更爱玩GIS。

声明

1.本文所分享的所有需要用户下载使用的内容(包括但不限于软件、数据、图片)来自于网络或者麻辣GIS粉丝自行分享,版权归该下载资源的合法拥有者所有,如有侵权请第一时间联系本站删除。

2.下载内容仅限个人学习使用,请切勿用作商用等其他用途,否则后果自负。

手机阅读
公众号关注
知识星球
手机阅读
麻辣GIS微信公众号关注
最新GIS干货
关注麻辣GIS知识星球
私享圈子

留言板(小编看到第一时间回复)