Offline reverse geocoder in Python using sqlite3

Overview

rgeocode

Offline reverse geocoder

rgeocode accepts a geographic coordinate pair (latitude and longitude) and returns a list containing the name of:

  • A geographical point
  • First administrative unit
  • Second administrative unit
  • Country

Credits: rgeocode uses data sourced from https://www.geonames.org/ and is used under a CC 4.0 license (link to Creative Commons 4.0)

Install

pip install r-geocode

>>>   from rgeocode import start_rgeocode
 
>>>   location = start_rgeocode(40.689247, -74.044502)
 
>>>   print(location)
    
['Statue of Liberty', 'New York', 'New York County', 'United States']

Requirements

  • sqlite3
  • python version >= 2.5

First run

The first time rgeocode is run, it attempts to download the required files (countryInfo.txt, admin1CodesASCII.txt, admin2Codes.txt) from geonames.org. The three files have a combined size of ~1.6GB. After the download completes, the required data is copied to a local sqlite3 database. After the database is created, the downloaded files are deleted. rgeocode creates - admin1.tsv, admin2.tsv, countries.tsv, and geo.db. The combined size of these files is ~600MB. Subsequent calls to start_rgeocode() reference the data in these files. The files are created in the same folder as the script in which start_rgeocode() is imported. When start_rgeocode() is called from the interactive shell the files are downloaded and created in the home path.

Options

If you need to reverse geocode for locations only in specific countries, you can reduce the size of the database (geo.db) by calling filter_rgeocode(stringList).

 >>>  from rgeocode import filter_rgeocode
 
 >>>  codelist = ['IN', 'US']
 
 >>>  status = filter_rgeocode(codelist)
 
 >>>  print(status)
 
 Database filtered: Deleted 9291519 rows.

To retrieve ISO country codes:

 >>>  from rgeocode import country_code
 
 >>>  codes = country_code()
                                                                                                             
 >>>  print(codes)
 
 {'AD': 'Andorra', 'AE': 'United Arab Emirates', ... , 'ZW': 'Zimbabwe', 'CS': 'Serbia and Montenegro'}

Other projects: Reverse geocoding postal codes

A Bot To remove forwarded messages

Forward-Mess-Remover A Bot To remove forwarded messages. uses Remove forwarded messages from Group. Deploy To Heroku

SpamShield 5 Oct 14, 2022
A stock information collector and parser for Taiwan and US market. Automatically send LINE message if the pre-defined rules are triggered.

agastock 開發動機 就在海運飆漲的2021年7月,差點跪在地上喜迎財富自由的當下,EPS超高好消息不斷的長榮竟然套在202元一去不回,有圖有真相(哭) 忽然體會到追高殺低不是辦法,魯蛇我得靠邏輯分析也能出頭天,經過三個月無數個不出門的周末,產出簡單的爬蟲和分析工具。 上過金融研訓院的量化交易

Gavin Lee 12 Nov 16, 2022
Telegram Google Translater Bot Can Translate Any Language To Your Selected Language

🔰 TELEGRAM GOOGLE TRANSLATER 🔰 • ⚡ INSTALLING ⚡ • • ✅ OFFICIAL SUPPORTS ✅ •

⚝ANKIT KUMAR⚝ 2 Jan 16, 2022
🥀 Find the start of the token !

Discord Token Finder Find half of your target's token with just their ID. Install 🔧 pip install -r requeriments.txt Gui Usage 💻 Go to Discord Setti

zeytroxxx 2 Dec 22, 2021
A bot written in Python to automate attending classes on MyClass (Codetantra).

codetantrabot This is python program to attend class on myclass(codetantra) Prerequisites You should have Python3 and Pip installed on your system Run

Aniket Kumar 1 Feb 08, 2022
Discord Bot for bugbounty Web

BugbountyBot Discord Bot for Bug Bounty Web The purpose of this bot is to automa

Beek Labs 6 May 03, 2022
GTPS Status Bot

Python GTPS Status Bot (BETA) Python GTPS Status Bot Require Python How To Use Download This Source Extract The Zip File Install the requirements (Mod

Lamp 4 Oct 11, 2021
This program is an automated trading bot that uses TDAmeritrades Thinkorswim trading platform's scanners and alerts system.

Python Trading Bot w/ Thinkorswim Description This program is an automated trading bot that uses TDAmeritrades Thinkorswim trading platform's scanners

Trey Thomas 201 Jan 03, 2023
A modified Sequential and NLP based Bot

A modified Sequential and NLP based Bot I improvised this bot a bit with some implementations as a part of my own hobby project :) Note: I do not own

Jay Desale 2 Jan 07, 2022
Tweet stream in OBS browser source

Tweetron TweetronはOBSブラウザーソースを使用してツイートを画面上に表示するツールソフトです Windowsのみ対応 (Windows10動作確認済) ダウンロード こちらから最新版をダウンロードしてください (現在ベータテスト版を配布しています) Download ver0.0.

Cube 0 Apr 05, 2022
Project for the discipline of Visual Data Analysis at EMAp FGV.

Analysis of the dissemination of fake news about COVID-19 on Twitter This project was the final work for the discipline of Visual Data Analysis of the

Giovani Valdrighi 2 Jan 17, 2022
PYAW allows you to call assembly from python

PYAW allows you to call assembly from python

2 Dec 13, 2021
🤖 Telegram UserBot Untuk Memutar Lagu Dan Video Di Obrolan Suara Telegram.

🤖 Telegram UserBot Untuk Memutar Lagu Dan Video Di Obrolan Suara Telegram.

Fariz 2 Nov 13, 2021
BaiduPCS API & App 百度网盘客户端

BaiduPCS-Py A BaiduPCS API and An App BaiduPCS-Py 是百度网盘 pcs 的非官方 api 和一个命令行运用程序。

Peter Ding 450 Jan 05, 2023
Tesseract Open Source OCR Engine (main repository)

Tesseract OCR About This package contains an OCR engine - libtesseract and a command line program - tesseract. Tesseract 4 adds a new neural net (LSTM

48.3k Jan 05, 2023
A free sniper bot built to work with PancakeSwap: Router V2

Pancakeswap Sniper Bot PancakeSwap sniper bot. Automated sniping bot to snipe crypto coin launches. How it works The sniping bot can be used in three

89 Aug 06, 2022
News API consisting various sources from Tanzania

Tanzania News API News API consisting various sources from Tanzania. Fork the project Clone the project git clone https://github.com/username/news-a

Innocent Zenda 6 Oct 06, 2022
Change the name and pfp of ur accounts, uses tokens.txt for ur tokens.

Change the name and pfp of ur accounts, uses tokens.txt for ur tokens. Also scrapes the pfps+names from a server chosen by you. For hq tokens go to discord.gg/tokenshop or t.me/praisetelegram

cChimney 36 Dec 09, 2022
Volt is yet another discord api wrapper for Python. It supports python 3.8 +

Volt Volt is yet another discord api wrapper for Python. It supports python 3.8 + How to install [Currently Not Supported.] pip install volt.py Speed

Minjun Kim (Lapis0875) 11 Nov 21, 2022
Simple discord token generator good for memberboosting your server! Uses Hcaptcha bypass

discord-tokens-generator INFO This is a Simple Discord Token Generator which creates unverified discord accounts These accounts are good for member bo

Avenger 41 Dec 20, 2022