geokdtree API documentation

# geokdtree

### A Geo KD Tree package for Python

## Quick Start:

    from geokdtree import GeoKDTree

    example_points = [
        (34.0522, -118.2437),  # Los Angeles
        (40.7128, -74.0060),   # New York
        (37.7749, -122.4194),  # San Francisco
        (51.5074, -0.1278),    # London
        (48.8566, 2.3522),     # Paris
    ]

    geo_kd_tree = GeoKDTree(points = example_points)
    test_point = (47.6062, -122.3321) # Seattle

    closest_idx = geo_kd_tree.closest_idx(test_point) # Expect San Francisco to be closest
    print(f"Closest point to {test_point} is {example_points[closest_idx] }")

### Documentation

- Docs: https://connor-makowski.github.io/geokdtree/geokdtree.html
- Git Repo: https://github.com/connor-makowski/geokdtree

# Development

## Running Tests, Prettifying Code, and Updating Docs

Make sure Docker is installed and running on a Unix system (Linux, MacOS, WSL2).

- Create a docker container and drop into a shell
  - `./run.sh`
- Run all tests (see ./utils/test.sh)
  - `./run.sh test`
- Prettify the code (see ./utils/prettify.sh)
  - `./run.sh prettify`

- Update the docs (see ./utils/docs.sh)

  - `./run.sh docs`

- Note: You can and should modify the `Dockerfile` to test different python versions.

View Source

     1"""
     2# GeoKDTree
     3[![PyPI version](https://badge.fury.io/py/geokdtree.svg)](https://badge.fury.io/py/geokdtree)
     4[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
     5[![PyPI Downloads](https://pepy.tech/badge/geokdtree)](https://pypi.org/project/geokdtree/)
     6<!-- [![PyPI Downloads](https://img.shields.io/pypi/dm/geokdtree.svg?label=PyPI%20downloads)](https://pypi.org/project/geokdtree/) -->
     7
     8
     9### A Geo KD Tree package for Python
    10
    11
    12![geokdtree](https://raw.githubusercontent.com/connor-makowski/geokdtree/main/static/geokdtree.png)
    13
    14## Quick Start:
    15```py
    16from geokdtree import GeoKDTree
    17
    18example_points = [
    19    (34.0522, -118.2437),  # Los Angeles
    20    (40.7128, -74.0060),   # New York
    21    (37.7749, -122.4194),  # San Francisco
    22    (51.5074, -0.1278),    # London
    23    (48.8566, 2.3522),     # Paris
    24]
    25
    26geo_kd_tree = GeoKDTree(points = example_points)
    27test_point = (47.6062, -122.3321) # Seattle
    28
    29closest_idx = geo_kd_tree.closest_idx(test_point) # Expect San Francisco to be closest
    30print(f"Closest point to {test_point} is {example_points[closest_idx] }")
    31```
    32
    33### Documentation
    34
    35- Docs: https://connor-makowski.github.io/geokdtree/geokdtree.html
    36- Git Repo: https://github.com/connor-makowski/geokdtree
    37
    38# Development
    39## Running Tests, Prettifying Code, and Updating Docs
    40
    41Make sure Docker is installed and running on a Unix system (Linux, MacOS, WSL2).
    42
    43- Create a docker container and drop into a shell
    44    - `./run.sh`
    45- Run all tests (see ./utils/test.sh)
    46    - `./run.sh test`
    47- Prettify the code (see ./utils/prettify.sh)
    48    - `./run.sh prettify`
    49- Update the docs (see ./utils/docs.sh)
    50    - `./run.sh docs`
    51
    52- Note: You can and should modify the `Dockerfile` to test different python versions.
    53
    54"""
    55
    56from .core import KDTree, GeoKDTree