All you have to do is define a proximity radius for each of the locations you stored in your data set. And then do a calculation of the distance between the current coordinates (latitude,longitude)
current and the store coordinates (latitude,longitude)
stored to find out the actual distance. If the actual distance is smaller or equal to the proximity radius you'll have to sound the alarm.
If you are unsure how to calculate the distance between two pairs of coordinates, see here:
Calculate distance, bearing and more between Latitude/Longitude points[
^].
[Edit]
var R = 6371;
var dLat = (lat2-lat1).toRad();
var dLon = (lon2-lon1).toRad();
var lat1 = lat1.toRad();
var lat2 = lat2.toRad();
var a = Math.sin(dLat/2) * Math.sin(dLat/2) +
Math.sin(dLon/2) * Math.sin(dLon/2) * Math.cos(lat1) * Math.cos(lat2);
var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a));
var d = R * c;
[/Edit]
Any questions left?
Regards,
Manfred