0

I am developing an Iphone monotouch application.

I am getting list of locations from server, i want to display only nearest location on the map among the list of locations.

please provide me related link, thank's in advance.

Dorababu Dodda
  • 452
  • 3
  • 23

2 Answers2

3

Location has latitude and lognitude. First sort by latitude and get the closest latitudes (+-x). Then filter again by closest longitudes(+-x). Then you have your points.

specialscope
  • 4,188
  • 3
  • 24
  • 22
  • Hi specialscope, can you please provide me any code or releated link – Dorababu Dodda Oct 19 '12 at 06:46
  • 1
    What you are looking for is called proximity search. Search stackoverflow for that you will get plenty. For eg. http://stackoverflow.com/questions/260335/proximity-search – specialscope Oct 19 '12 at 06:48
  • i am trying the above 3 lines of code but i did not found the System.Device.Location assemly or namespace, can you please provide me the dll.Please – Dorababu Dodda Oct 19 '12 at 07:40
  • 1
    Don't just use the numerically nearest lat and long unless all your points are very close to each other. 1 degree of longitude = 1 degree of latitude at the equator, but no where else. The lat/long grid is not square. – Craig Oct 20 '12 at 07:26
0

You can use a Distance Matrix API. Using this API you can calculate distances between any given positions.