我是 PowerApps 的新手。我有一個共享點串列,其中包含一組不同位置的坐標。我需要弄清楚的是,當用戶在手機上使用 PowerApps 應用程式時,使用 Haversine 公式在這些坐標的特定距離內。雖然Haversine 公式使用硬編碼目標位置以測驗/簡單的方式作業,但我需要共享點串列中的目標位置。這是我的代碼,它位于 Timer End 中:
ForAll(
irfan_yard_locations,
With(
{
r: 6371000, p: (Pi() / 180), latA: location_lat, lonA: location_long, latB: Location.Latitude, lonB: Location.Longitude
},
Round((2 * r) * Asin(Sqrt(0.5 - Cos((latA - latB) * p)/2 Cos(latB * p) * Cos(latA * p) * (1 - Cos((lonA - lonB) * p)) / 2)), 2 ));
) ;
irfan_yard_locations是具有location_lat和location_long坐標的 SP 串列。我在想像在這個示例站點中的東西:http : //powerappsguide.com/blog/post/formula-how-to-use-the-if??-and-switch-functions這樣如果從 回傳with (),這將是一個數字,小于 5(以米為單位)然后導航到另一個螢屏或執行某些操作。就是不知道語法。或者有更好的方法嗎?
謝謝!
uj5u.com熱心網友回復:
沒關系。通過在函式If周圍放置一個子句With,我能夠捕捉到當前位置是否在其中一個坐標集的 6 米內。
ForAll(
irfan_yard_locations,
If ( With(
{
r: 6371000, p: (Pi() / 180), latA: location_lat, lonA: location_long, latB: Location.Latitude, lonB: Location.Longitude
},
Round((2 * r) * Asin(Sqrt(0.5 - Cos((latA - latB) * p)/2 Cos(latB * p) * Cos(latA * p) * (1 - Cos((lonA - lonB) * p)) / 2)), 2 )) < 6, Navigate(Screen2));
) ;
轉載請註明出處,本文鏈接:https://www.uj5u.com/yidong/329733.html
上一篇:使用可格式化包自動自定義表格
下一篇:雖然回圈沒有中斷(Python)
