Polygon geofencing with iOS

[亡魂溺海] 提交于 2019-12-20 11:08:58

问题


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:


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 the polygon, unless you need to be notified when exiting the polygon as well
  • turn off the GPS when the device gets notified as outside the circular 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:

  • https://github.com/thedilab/v3-polygon-shape-creator
  • https://github.com/tparkin/Google-Maps-Point-in-Polygon


来源:https://stackoverflow.com/questions/23789341/polygon-geofencing-with-ios

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!