# Math.radians is not a function(Geofence)

I plot marker on map as boundary, and every time I click in a certain location of map I get the latlang coordinates and save it to my database,

this is the sample coordinates that was saved in my database

53.198526418064645,-105.76238214969635
53.198564980328875,-105.76508045196533
53.199002016899044,-105.76231241226196
53.19939406061905,-105.76508045196533
53.19941012790812,-105.76509118080139
53.19941976827867,-105.76212465763092
53.199426195191194,-105.76357841491699

Now I want that if the user passes each coordinate or gets inside 5 meters perimeter of each coordinates it will prompt like this, the user “get’s in” or “get’s out” in the area.but i have no idea how do i achieve like this to detect if the user passes or get inside in this 5 meters peremeter in each coordinates.is this possible?

I followed this example approach

but i got an error,Math.radians is not a function!

this is my code

``````
function geofence(){
/****this is the latng coordinates user's tracker location*****/
\$lat = 53.199425;//this is the lat user's tracker
\$lng = -105.763580;//this is the lng user's tracker

/*****************************************************************/
//here i don't know how to put 5 meters  radius.and i get error in using Math.radians is not a function.

}

``````

Radians are worked out by multiplying the degrees angle by Tau over 360.

``````
var TAU = 2 * Math.PI;
return degrees * TAU / 360;
}

``````

Or, now that Brendan Eich is going to champion the inclusion of Math.TAU, I’ve been taking to doing the following instead:

``````
if (!Math.TAU) {
Math.TAU = 2 * Math.PI;
}
// ...
return degrees * Math.TAU / 360;
}

``````

Yes, you could just use Math.PI/180, but to me it just seems to be counter-intuitive to use half a circle to convert degrees around a circle.

Hi paul,

Thank you for the quick reply,I am just confuse how can i apply the 5 meters in my code?

JavaScript doesn’t have a Math.radians function.

``````
var TAU = 2 * Math.PI;
return degrees * TAU / 360;
}

``````

Once you have that function, you can use it to convert degrees into radians, for example:

``````

``````

Hi paul,thanks i got exactly same output of your comment…can i ask do i need to covert the 3959 into meter ?

Only if you want the answer in metres.
Look at the Great circle page and you will see that the number is the radius of the earth.

Hi paul,ok so i will change it to meters,so if i want 5 meters , i will just do this

if (distance <5){
Thank you paul 