Is it possible with a C# library or an update database about geographical coordinates coutries to get the country name from latitude and longitude Without an API like the Google Maps’ JavaScript API ?
I've created a github project that will get country or american state based on gps point (lat ; lon) see here
if found, will return a locationInfo class with Id and Name
also available as a nuget package
You can use GeoNames and download a local database here.
And so, this is a sample query that you can use to obtain the nearest entry from a lat/long coordinate.
var query = new SQLiteCommand("select name,latitude,longitude,country_code,feature_code from geoloc order by ((latitude - @lat) * (latitude - @lat) + (longitude - @lng) * (longitude - @lng)) LIMIT 1, cn);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With