最も近い位置の計算
別の位置に最も近い位置を見つけ、それら 2 つの位置間の距離を計算します。
以下の演算子を使用して、最も近いジオメトリー、または最も近いジオメトリーの最大数を検出します。
- the nearest polygon among <polygons> to <a geometry>
- the <a number> nearest polygons among <polygons> to <a geometry>
ポイント、ライン・ストリング、および汎用ジオメトリーについても同様の演算子が使用可能です。
以下の演算子を使用して、2 つのジオメトリー間の距離を計算します。
- the distance between <a geometry> and <a geometry> in <a length unit>
- all <geometries> within distance of <a number> <a length unit> to <a geometry>
以下の例で、駐車エリアは、ビジネス・モデル内でポリゴンとして定義されています。このルールは、車の位置に最も近い駐車場を検出し、その距離をキロメートルで計算します。
when a car issue event occurs
definitions
set 'parking lots' to the parking lots of 'the organization';
set 'nearest parking lot' to the nearest polygon among the parking areas of 'parking lots' to the location of this car issue event;
then
print "the nearest parking lot is within " + the distance between 'nearest parking lot' and the location of this car issue event in kilometers + "kilometers";