本文介绍了使用iOS进行多边形地理围栏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图找到一种方法来用iOS创建多个多边形地理栅栏。我需要在城市中绘制多个区域来表示区域,街道等。从我迄今为止阅读的内容来看,iOS只允许来自地理定位设备的圆形区域。


  1. iOS可行吗?

  2. 是否有一个Web应用程序可以在地图上绘制多边形并在数组中生成坐标?


我开发了类似的功能,所以我建议您做以下几点:


  • 创建嵌入多边形的圆形地理栅栏 li>
  • 当设备被通知位于循环地理围栏内时,每次获取位置更新时,
    启动GPS

  • ,检查其是否存在在多边形内坐标为
    只要在
    多边形内找到设备的位置,就立即关闭GPS,除非在退出多边形时需要通知您当
    圆形地理围栏以外的设备收到通知时关闭GPS



由于您需要多边形地理围栏,因此我认为您期望精确度很高,因此无论如何您需要在地理围栏上使用额外的GPS层,因为地理围栏根本不准确。 / b>

2)看看这些链接:





I am trying to find a way to create several polygon geofences with iOS. I need to draw multiple zones in a city to represent areas, streets, etc. From what I've read so far, iOS only allows circular zone from a geolocated device.

  1. Is it feasible with iOS?
  2. Is there a web app somewhere to draw polygons on a map and generate the coordinates in an array?
解决方案

1) iOS only allows to create circular geofences indeed however what you are trying to achieve is possible with some extra logic.I have developed similar features so I suggest you to do the following:

  • create a circular geofence that embeds your polygon
  • when the device gets notified as being within the circular geofence,start the GPS
  • every time you get a location update, check if its coordinates are within the polygon
  • turn off the GPS as soon as the device's location is found within thepolygon, unless you need to be notified when exiting the polygon aswell
  • turn off the GPS when the device gets notified as outside thecircular geofence

As you need polygon geofences I guess you expect a good level of accuracy, so you would need to use an extra layer of GPS on top of the geofencing anyways, as geofencing is not accurate at all.

2) Have a look at those links:

这篇关于使用iOS进行多边形地理围栏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-31 16:12