Find latitude longitude within 100 km radius RRS feed

  • Question

  • User-940575426 posted

    Hello All.......

    I am new in Asp.Net WCF REST Web Service development..........

    I am working on Asp.Net WCF REST Web Service application which is using c# and MS SQL Server 2008 R2 as database. I want to have a list of locations within 100 km radius from a specified location. I do have a list of latitude and longitude stored in a table of database. I want to have one method in service which finds out the list of lat long within 100 km radius from a specified lat long.

    As this is the Web service, so I think the code must be written in c# or sql stored procedure.

    Can anybody help me to perform this?.

    Thanks in advance.

    - Regards

    Friday, December 25, 2015 12:09 PM

All replies

  • User475983607 posted

    Here's a tutorial on calculating distances using longitude and latitude found with a simple google search.


    Can anybody help me to perform this?.

    What do you need help doing?  Do you have a specific support question related to REST services?  Are you receiving an error?  Is the DB populated with longitude and latitude data and you need help writing the code in C# or TSQL?  Can you post what you are written so far?

    Friday, December 25, 2015 12:58 PM
  • User-940575426 posted


    Thanks for replying.

    I know how to write the code & respond using REST, I just need a logic to calculate all the latitude longitude points within 100 km radius for a particular lat long.

    I have written the code as mentioned below so far in a service method:

    List<LatLongs> templst = new List<LatLongs>();
    decimal lat = 23.0317;
    decimal long = 72.5655;
    templst = new objDA().GetLatLongData();

    //templst = templst.FindAll();

    Now in above code, templst will be having all the lat longs presently available in db to filter out, how to filter the lat longs within 100 km radius from templst for lat long 23.0317, 72.5655?


    Monday, December 28, 2015 5:29 AM
  • User475983607 posted

    The link above shows how to calculate distance between two points on the glob.

    SQL server and .NET both can handle Geography



    Again this formation was found using Google.

    Monday, December 28, 2015 12:21 PM