SQLite Forum

Country-coding from Lat/Long, using GeoPoly and/or R-Tree
Login
Geopoly works quite well.  I have implemented (among others) a system which will find the approporate IANA Timezone for a given lat/long -- it works quite well, with the following caveats:

 - there is a standard for polygon objects -- nothing follows it, especially things that claim they do  
 - the SQLite3 implementation does not "support" holes  
 - it is possible for one country to be entirely contained within another and you will have to figure out how to resolve a point being "inside" two "countries" at once  
 - yes, you can find "near" countries simply by making you location "point" into a circle and getting the list of overlapping polygons  
 - it is very fast but only uses single precision floating point so the resolution if you use native spherical coordinates (ie, lat/long) is about on par with uncorrected orbital pseudorange systems