簡體   English   中英

創建自定義形狀多邊形作為地理圍欄區域?

[英]Create a custom shape polygon as a region for geofencing?

目前我們有一個坐標數組,坐標將勾勒出一個矩形形狀。

  var coordinatesArray: [CLLocationCoordinate2D] = []

    override init() {
        super.init()

 //top left
        coordinatesArray.append(CLLocationCoordinate2D(latitude: 32.7915055, longitude: -96.8028408))
        //top right
        coordinatesArray.append(CLLocationCoordinate2D(latitude: 32.7919914, longitude: -96.8022031))
        //bottom left
        coordinatesArray.append(CLLocationCoordinate2D(latitude:  32.7910108, longitude: -96.8025008))
        //bottom right
        coordinatesArray.append(CLLocationCoordinate2D(latitude: 32.7915926, longitude: -96.8016962))

}

截至目前,它要求一個圓形區域來監控:

let geoFenceRegion:CLCircularRegion = CLCircularRegion(center: CLLocationCoordinate2DMake(32.7915926, -96.8016962), radius: 100, identifier: "Dallas")

我們想要的是適合坐標形狀的地理圍欄。 幾年前我看到這篇文章說你不能創建自定義區域:

自定義形狀區域

這甚至可以創建自定義形狀區域嗎?

不,據我所知地理圍欄總是圓形的。 您可以組合多個較小的圓形區域以創建更接近您想要的形狀(盡管位置區域的總數限制相當小(如果有記憶的話,總共 20 個)

您可以使用第三方 API(如 TomTom 的 API)來實現。 您可以創建圓圈、螺旋線、走廊,將它們存儲在雲中,甚至在跟蹤對象進入、退出或停留時觸發事件。

https://developer.tomtom.com/geofencing-api/geofencing-api-documentation

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM