A geo database for polygons, foundations - Fabrice Aneche
On a previous post, I’ve described how to use the S2 geo library to create a fast geo database, but it was to store locations (points) and only to perform range queries, a complete geo database would have regions/polygons queries.
Looking for a solution I had this need: querying for the countries or subregions of hundreds of coordinates per second, without relying on an external service.
One solution, using my previous technique, could have been to store every cities in the world and then perform a proximity query around my point to get the closest cities, but it works only in populated area and it’s only an approximation.
blog.nobugware.com