Topic: Defining logic for when vehicle coords fall within geofence bounds
Hi Wialon team,
I am defining logic in Python to understand when our moving assets have crossed into our defined geofences. I am using get_zone_data method to get the coordinates of our geofences:
from urllib.parse import urlencode
import json
params = {
"itemId": 6776, # not sure why I have to specify ids of our moving assets for details about geofences, where is the relation?
"col": [1],
"flags": 7
}
encoded_params = urlencode({"params": json.dumps(params)}, doseq=True)
geofence_url = f"https://ls2a.locationsolutions.com/wialon/ajax.html?svc=resource/get_zone_data&{encoded_params}&sid={sid}"
print(geofence_url)
I am getting the following sample data:
[{"id":1,"ar":57066.8398603,"pr":974.44449707,"b":{"min_x":55.6299445629,"min_y":24.6950722587,"max_x":55.6340762805,"max_y":24.6990892958,"cen_x":55.6320104217,"cen_y":24.6970807773},"ct":1578920042,"mt":1584510923}]
My main concern is that if I relying on min and max x and y, and saying that vehicle coordinates should fall within these values, that I am not capturing the full shape of the geofence and I missing out on data as a result. Can you please provide us with support on how we can ensure we are capturing all data related to vehicles entering geofence areas? If there are additional parameters that can help in plotting the geofence that I am not getting through this get_zone_data API call for example. Thanks and regards.