Skip to main content

Cities is a simple tool for searching cities located at a given longitude and latitude range.

Project description

Cities is a simple tool for searching cities located at a given longitude and latitude range. All the cities returned are sorted by the importance of a city and the population density.

Features

  1. fast(less than 0.01s for each searching), simple and convenient.
  2. cover all the cities around the world.
  3. the author is cute.

Required File

Download the city data and put it at any directory you want. Remember to set the path up when you initiate an instance.

Example

cr = CitiesRetriever("Sources/worldcities.csv")
cities = cr.retrieve_cities(-124.71, -77.21, 25.24, 44.75, 50) # starting longitude, ending longitude, starting latitude, ending latitude, the number of the cities 
print(json.dumps(cities, indent=2))

Note

it might take you a little time(37s for building dict, 13s to load the dict) when you first invoke the retrieve method. But the building process would happen only once, and the loading process only occurs when you initiate an instance. The retrieving time is still stay around 0.001s ~ 0.01s(it depends on how many cities you want). The mainly time-consuming part in retrieving is a sorting part.

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

Cities-0.6.tar.gz (4.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

Cities-0.6-py2.py3-none-any.whl (5.0 kB view details)

Uploaded Python 2Python 3

File details

Details for the file Cities-0.6.tar.gz.

File metadata

  • Download URL: Cities-0.6.tar.gz
  • Upload date:
  • Size: 4.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.1 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.7

File hashes

Hashes for Cities-0.6.tar.gz
Algorithm Hash digest
SHA256 582f6f78c356baa585fa0e4b8861cb1733ee5c6f12a220ca955b16bcc20460a9
MD5 988afa9084c40d3466c6059d11a01e14
BLAKE2b-256 c76ec0f80d62cd5bdb2113e3797521a785205113f33614536edfc90c721fa15c

See more details on using hashes here.

File details

Details for the file Cities-0.6-py2.py3-none-any.whl.

File metadata

  • Download URL: Cities-0.6-py2.py3-none-any.whl
  • Upload date:
  • Size: 5.0 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.1 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.7

File hashes

Hashes for Cities-0.6-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 32e7b0c977f209373a1ae7facf184ec08a26a897afaee799c55df6c802cf1f1d
MD5 863326d574af610b1f8e8725174e4aff
BLAKE2b-256 f8d9b91bbc5f1987be9d5340e9fd1c1c61ac7b192c159df43c41ccb83127d07a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page