本文最后更新于 307 天前,其中的信息可能已经有所发展或是发生改变。
坐标字段表达式
concat(to_string(round($x, 2)), ',', to_string(round($y, 2)))
方位字段表达式-点
CASE
WHEN degrees ( azimuth ( make_point ($x, $y), make_point (341514.472297, 3071106.526640))) > 22.5 AND degrees ( azimuth ( make_point ($x, $y), make_point (341514.472297, 3071106.526640))) <= 67.5 THEN '西南'
WHEN degrees ( azimuth ( make_point ($x, $y), make_point (341514.472297, 3071106.526640))) > 67.5 AND degrees ( azimuth ( make_point ($x, $y), make_point (341514.472297, 3071106.526640))) <= 112.5 THEN '西'
WHEN degrees ( azimuth ( make_point ($x, $y), make_point (341514.472297, 3071106.526640))) > 112.5 AND degrees ( azimuth ( make_point ($x, $y), make_point (341514.472297, 3071106.526640))) <= 157.5 THEN '西北'
WHEN degrees ( azimuth ( make_point ($x, $y), make_point (341514.472297, 3071106.526640))) > 157.5 AND degrees ( azimuth ( make_point ($x, $y), make_point (341514.472297, 3071106.526640))) <= 202.5 THEN '北'
WHEN degrees ( azimuth ( make_point ($x, $y), make_point (341514.472297, 3071106.526640))) > 202.5 AND degrees ( azimuth ( make_point ($x, $y), make_point (341514.472297, 3071106.526640))) <= 247.5 THEN '东北'
WHEN degrees ( azimuth ( make_point ($x, $y), make_point (341514.472297, 3071106.526640))) > 247.5 AND degrees ( azimuth ( make_point ($x, $y), make_point (341514.472297, 3071106.526640))) <= 292.5 THEN '东'
WHEN degrees ( azimuth ( make_point ($x, $y), make_point (341514.472297, 3071106.526640))) > 292.5 AND degrees ( azimuth ( make_point ($x, $y), make_point (341514.472297, 3071106.526640))) <= 337.5 THEN '东南'
ELSE '南'
END
方位字段表达式-线段
CASE
WHEN degrees ( azimuth ( make_point (x(start_point($geometry)), y(start_point($geometry))), make_point (x(end_point($geometry)), y(end_point($geometry))))) > 22.5 AND degrees ( azimuth ( make_point (x(start_point($geometry)), y(start_point($geometry))), make_point (x(end_point($geometry)), y(end_point($geometry))))) <= 67.5 THEN '西南'
WHEN degrees ( azimuth ( make_point (x(start_point($geometry)), y(start_point($geometry))), make_point (x(end_point($geometry)), y(end_point($geometry))))) > 67.5 AND degrees ( azimuth ( make_point (x(start_point($geometry)), y(start_point($geometry))), make_point (x(end_point($geometry)), y(end_point($geometry))))) <= 112.5 THEN '西'
WHEN degrees ( azimuth ( make_point (x(start_point($geometry)), y(start_point($geometry))), make_point (x(end_point($geometry)), y(end_point($geometry))))) > 112.5 AND degrees ( azimuth ( make_point (x(start_point($geometry)), y(start_point($geometry))), make_point (x(end_point($geometry)), y(end_point($geometry))))) <= 157.5 THEN '西北'
WHEN degrees ( azimuth ( make_point (x(start_point($geometry)), y(start_point($geometry))), make_point (x(end_point($geometry)), y(end_point($geometry))))) > 157.5 AND degrees ( azimuth ( make_point (x(start_point($geometry)), y(start_point($geometry))), make_point (x(end_point($geometry)), y(end_point($geometry))))) <= 202.5 THEN '北'
WHEN degrees ( azimuth ( make_point (x(start_point($geometry)), y(start_point($geometry))), make_point (x(end_point($geometry)), y(end_point($geometry))))) > 202.5 AND degrees ( azimuth ( make_point (x(start_point($geometry)), y(start_point($geometry))), make_point (x(end_point($geometry)), y(end_point($geometry))))) <= 247.5 THEN '东北'
WHEN degrees ( azimuth ( make_point (x(start_point($geometry)), y(start_point($geometry))), make_point (x(end_point($geometry)), y(end_point($geometry))))) > 247.5 AND degrees ( azimuth ( make_point (x(start_point($geometry)), y(start_point($geometry))), make_point (x(end_point($geometry)), y(end_point($geometry))))) <= 292.5 THEN '东'
WHEN degrees ( azimuth ( make_point (x(start_point($geometry)), y(start_point($geometry))), make_point (x(end_point($geometry)), y(end_point($geometry))))) > 292.5 AND degrees ( azimuth ( make_point (x(start_point($geometry)), y(start_point($geometry))), make_point (x(end_point($geometry)), y(end_point($geometry))))) <= 337.5 THEN '东南'
ELSE '南'
END