GeoNames Home | Postal Codes | Download / Webservice | About 

GeoNames Forum
  [Search] Search   [Recent Topics] Recent Topics   [Groups] Back to home page 
[Register] Register / 
[Login] Login 
Python program to generate local SQLite/SpatiaLite DB  XML
Forum Index -> General
Author Message
ejayt



Joined: 07/01/2020 20:16:49
Messages: 2
Offline

Hey guys! I wrote a small Python program that grabs a GeoNames database of your choosing and forms a SpatiaLite database that returns the closest place name with a given latitude and longitude - Useful if you need to query for this all the time. The query time from the command line is about 0.4-0.6 seconds.

I hope someone else can find some use for this. I ran into problems with over querying MapQuest for this data in one of my other Python programs (and the allCountries.txt from GeoNames has far more data anyway).

https://github.com/evanjt/closestgeoname
SergioCob



Joined: 19/05/2018 12:15:06
Messages: 1
Offline

Can you use this program to automatically make queries?
ejayt



Joined: 07/01/2020 20:16:49
Messages: 2
Offline

SergioCob wrote:
Can you use this program to automatically make queries? 


Hi, yes, an example is here:
https://github.com/evanjt/elodie/blob/08069dbc0eae12fb98f8b8a36894e1dedfdd798f/elodie/geolocation.py#L155-L161

The output of the function query_closest_city() is a tuple of (city, state, country)
 
Forum Index -> General
Go to:   
Powered by JForum 2.1.5 © JForum Team