A bunch of utilities for working with czech municipalities
Project description
geo locations
A simple package for managing czech municipalities. It enables to scrape source data (czech municipalities together with their GPS coordinates), store them into ES index and then make queries.
Installation
Using pip
pip3 install geo-places
Directly from github
pip3 install git+https://github.com/bauerji/geo_locations.git
Usage
Location index preparation
import asyncio
from pathlib import Path
from geo_places.dataset import gener_dataset
from geo_places.elasticsearch.handler import ElasticClient
url = "https://wwwinfo.mfcr.cz/ares/obce/ares_obce.html.cz"
# this is a default path where the data file lands after package installation
path = Path("/usr/local/data/municipality_population.csv")
async def populate():
es = ElasticClient("localhost")
await es.index_location_objects(gener_dataset(path))
def main():
asyncio.run(populate())
if __name__ == '__main__':
main()
Location suggest
from geo_places.elasticsearch.handler import ElasticClient
if __name__ == '__main__':
es = ElasticClient("localhost")
suggestions = es.suggest_location("hor")
for suggestion in suggestions:
print(suggestion.name, suggestion.population)
Location search
from geo_places.elasticsearch.handler import ElasticClient
if __name__ == '__main__':
es = ElasticClient("localhost")
results = es.search_location("prha 10", fuzzy=True)
for result in results:
print(result)
TODOs:
- tests
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
geo_places-0.0.4.tar.gz
(48.7 kB
view hashes)
Built Distribution
geo_places-0.0.4-py3-none-any.whl
(49.4 kB
view hashes)
Close
Hashes for geo_places-0.0.4-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 83b316b4ce9b25dd6d2a4cd9b25272b0d31e97c40478877a5605109f55023110 |
|
MD5 | 75680529f1155e34c93c9821b70712d7 |
|
BLAKE2b-256 | c7eb08b91b61e0d709d0a0e1f5493f0c6d4e18d4a67dc7e8090b0439e89f6ae2 |