how to Calculate google map circle radius js to C#

c#-4.0, google-maps-api-3

Solution

Distance between 2 points: (lat1,lon1) to (lat2,lon2)

distance = acos(
     cos(lat1 * (PI()/180)) *
     cos(lon1 * (PI()/180)) *
     cos(lat2 * (PI()/180)) *
     cos(lon2 * (PI()/180))
     +
     cos(lat1 * (PI()/180)) *
     sin(lon1 * (PI()/180)) *
     cos(lat2 * (PI()/180)) *
     sin(lon2 * (PI()/180))
     +
     sin(lat1 * (PI()/180)) *
     sin(lat2 * (PI()/180))
    ) * 3959

3959 is the Earth radius in Miles. Replace this value with radius in KM, (or any other unit), to get results on the same unit.

You can verify your implementation by comparing to this worked example:

Problem

I know how to use the javascript to calculate the radius by using the below code ``` var center = new google.maps.LatLng(3.2987599, 102.6872022); var latLng = new google.maps.LatLng(3.0987599, 101.6872022); var distanceInMetres = google.maps.geometry.spherical.computeDistanceBetween(center, latLng); ``` But how to convert the google.maps.geometry.spherical.computeDistanceBetween into C# function?

Original source

Related problems