WebGMaps Need Suggestion for GeoFencing

Hi,


I want to add geofence to my project also known as zone alert. For example i want to save my home's coordinates as 200 meters radius, and when my gps device enter or exit in that radius my project will alert me. Getting simple coordinates is ok but i couldn't manage to understand how i get coordinates like 200 meters radius ?

Hi,


Please note that the geolocation API that is used in WebGMaps unfortunately does not support this kind of technique.
We'll have to investigate if this feature can be implemented in a future version of the component.

Hi Bart,


If you guys can add that kind of option to future updates that will be great. (If it's possible of course :) )
Hi,

After some research i've found a way to add GeoFence support to my project and i want to share here in case of anybody needed in the future.

My approach is based on calculating distance between two coordinates. 

For example you have a point on the map (school,church,any company's HQ and so on.) and you want to use geofence system to get notifications tracking object (Car,Person etc.) is near to that point. You can calculate distance as mile-meter or kilometer with below code and trigger notifications according to distance. I've tested this calculation with LiveData in my project and working well.



var mlat,mlon,klat,klon,hesap,mile,mt,km:Double;
begin
//mlat : HQ Lat - Edit1
//mlon : HQ Lon - Edit2
//klat : Pos. Lat - Edit3
//klon : Pos.Lon - Edit4
//hesap : calculation
//mile : mile - Edit5
//mt : meter - Edit6
//km : kilometer - Edit7
mlat:=StrToFloat(StringReplace(trim(Edit1.Text), '.', ',', [rfReplaceAll]));
mlon:=StrToFloat(StringReplace(trim(Edit2.Text), '.', ',', [rfReplaceAll]));
klat:=StrToFloat(StringReplace(trim(Edit3.Text), '.', ',', [rfReplaceAll]));
klon:=StrToFloat(StringReplace(trim(Edit4.Text), '.', ',', [rfReplaceAll]));
hesap:=3958.75 * ArcCos(Sin(klat/57.2958) * Sin(mlat / 57.2958) + Cos(klat / 57.2958) * Cos(mlat / 57.2958) * Cos(klon / 57.2958 - mlon / 57.2958));
mile:=hesap;
mt:=Round(hesap / 0.00062137);
km:=Round(mt/1000);
Edit5.Text:=FloatToStr(mile);
Edit6.Text:=floattostr(mt);
Edit7.Text:=floattostr(km);


I don't know are we allowed to share source codes in this forum but if moderators allow me i can share source code of calculation sample too.

Sorry for bad English :)