I have a Latitude Column in the db that has values that look like this 41.230524
, using HTML5 geolocation I get a more accurate Latitude that will look like this 41.230524081
I want to find the row in my db that is closest to the Latitude returned from Geolocation. I was thinking something like
var myCity = db.zipcodes.Where(x => LatFromGeoCode.StartsWith(x.Latitude)).FirstOrDefault();
the problem with that is there may be different cities in the db that start with 41.2XXXXX , I don't just want the first one , I want the closest match
I was thinking maybe a loop first trying to match the full LatFromGeo, then -1 char , then try again , it seems there must be a better way