This package will take a latitude and longitude coordinate which will return the country, city name, alternate name(s), population, timezone, and exact coordinates of the city.
Project description
GeoNames - Find City Name with Population > 1000
Opendatasoft has as a dataset from GeoNames which contains all cities with a population greater than a thousand people. This dataset will be used to create a reverse geocode function, called search. This project has been inspired by Richard Penman's reverse-geocode project. Like Richard Penman's approach, I too am using a k-d tree which is implemented using the SciPy library.
This package will take a latitude and longitude coordinate which will return the country, city name, alternate name(s), population, timezone, and exact coordinates of the city.
Dependencies
- Python 3.11.4
- Pandas 2.0.3
- SciPy 1.11.1
Example usage:
This package only has one function search and it has a single parameter coordinate.
Enter latitude and longitude into the search function, as a list, to get your results.
>>> import pygeocity
>>> pygeocity.search([11.85812, -86.23922])
Outputs:
{
0: 3620170,
1: 'Diriamba',
2: 'Diriamba',
3: 'Diriamba,Diriambo',
4: 'NI',
5: 'Nicaragua',
6: 35008,
7: 'America/Managua',
8: '2018-08-08',
9: 'Nicaragua',
10: '11.85812, -86.23922',
11: ' -86.23922',
12: '11.85812'
}
One can also enter a list of multiple latitudes and longitudes into the search function to get your results.
>>> pygeocity.search([11.85812, -86.23922],[12.4825, -87.17304])
Outputs:
{
'Geoname ID': {0: 3620170, 1: 3620269},
'Name': {0: 'Diriamba', 1: 'Corinto'},
'ASCII Name': {0: 'Diriamba', 1: 'Corinto'},
'Alternate Names': {0: 'Diriamba,Diriambo', 1: 'Corinto'},
'Country Code': {0: 'NI', 1: 'NI'},
'Country name EN': {0: 'Nicaragua', 1: 'Nicaragua'},
'Population': {0: 35008, 1: 19183},
'Timezone': {0: 'America/Managua', 1: 'America/Managua'},
'Modification date': {0: '2018-08-08', 1: '2018-08-08'},
'LABEL EN': {0: 'Nicaragua', 1: 'Nicaragua'},
'Coordinates': {0: '11.85812, -86.23922', 1: '12.4825, -87.17304'},
'Longitude': {0: ' -86.23922', 1: ' -87.17304'},
'Latitude': {0: '11.85812', 1: '12.4825'}
}
Install
Warning: package data is not yet uploaded correctly, can not install with pip.
pip install pygeocity
pip3 install pygeocity
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pygeocity-0.1.2.tar.gz.
File metadata
- Download URL: pygeocity-0.1.2.tar.gz
- Upload date:
- Size: 9.7 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
29995712482ceea23abfa748aa32c9bc0f9ab00d01b2d70f269f60bac38524e6
|
|
| MD5 |
870ee1a0e78f89e19e66d2536734317b
|
|
| BLAKE2b-256 |
e43ef0e91001cada33376a8424b3a031e569d6979fb8ba24433303ea332bed94
|
File details
Details for the file pygeocity-0.1.2-py3-none-any.whl.
File metadata
- Download URL: pygeocity-0.1.2-py3-none-any.whl
- Upload date:
- Size: 9.8 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a3b6aecaad2d8e930426f4fbf1eb579fc2e73bc5954d8b88924bd2b2b24b3166
|
|
| MD5 |
9129810bc4fb6e9db3e021495c2562b8
|
|
| BLAKE2b-256 |
cb4845f11765dd4b253d692701a26486be1295851bcdc78a46d0f5a0dc4cf5f4
|