Skip to main content

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)
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

Metadata

Release files for geo-places 0.0.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for geo-places 0.0.4
File Size Uploaded
geo_places-0.0.4.tar.gz 48.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for geo-places 0.0.4
File Interpreter ABI Platform
geo_places-0.0.4-py3-none-any.whl Python 3 none any Details

Total release size: 98.1 kB

Release files / geo_places-0.0.4.tar.gz

Download URL geo_places-0.0.4.tar.gz
Size 48.7 kB
Tags Source
SHA-256 checksum
How to use checksums
92de94edae4ef865a38c18c975d39e97ddb86db21518c2e81340734119f06c70
BLAKE2b-256 checksum
How to use checksums
44c806568fea7f85bcd5e0f33b27d965b3c9fc77c86c331bb84540b205537d30
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.37.0 CPython/3.7.4

Release files / geo_places-0.0.4-py3-none-any.whl

Download URL geo_places-0.0.4-py3-none-any.whl
Size 49.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
83b316b4ce9b25dd6d2a4cd9b25272b0d31e97c40478877a5605109f55023110
BLAKE2b-256 checksum
How to use checksums
c7eb08b91b61e0d709d0a0e1f5493f0c6d4e18d4a67dc7e8090b0439e89f6ae2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.37.0 CPython/3.7.4

Release history Release notifications | RSS feed

This release

0.0.4 This release

2 release files

0.0.3

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page