Skip to main content

No project description provided

Project description

Polars-Reverse-Geocode

Polars plugin based on https://github.com/gx0r/rrgeo.

rrgeo takes a latitude and longitude as input and returns the closest city, country, latitude, and longitude, using a k-d tree to efficiently find the nearest neighbour based on a known list of locations. This can be useful if you need to reverse geocode a large number of coordinates quickly, or just need the rough location of coordinates but don't want the expense or complication of an online reverse geocoder.

Installation

pip install polars-reverse-geocode

Usage example

import polars as pl

from polars_reverse_geocode import find_closest_city

df = pl.DataFrame({
    'lat': [37.7749, 51.01, 52.5],
    'lon': [-122.4194, -3.9, -.91]
})
print(df.with_columns(city=find_closest_city('lat', 'lon')))
shape: (3, 3)
┌─────────┬───────────┬───────────────────┐
│ lat     ┆ lon       ┆ city              │
│ ---     ┆ ---       ┆ ---               │
│ f64     ┆ f64       ┆ str               │
╞═════════╪═══════════╪═══════════════════╡
│ 37.7749 ┆ -122.4194 ┆ San Francisco     │
│ 51.01   ┆ -3.9      ┆ South Molton      │
│ 52.5    ┆ -0.91     ┆ Market Harborough │
└─────────┴───────────┴───────────────────┘

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

polars_reverse_geocode-0.4.2.tar.gz (20.7 kB view hashes)

Uploaded Source

Built Distributions

polars_reverse_geocode-0.4.2-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (8.8 MB view hashes)

Uploaded CPython 3.8+ manylinux: glibc 2.17+ x86-64

polars_reverse_geocode-0.4.2-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (8.2 MB view hashes)

Uploaded CPython 3.8+ manylinux: glibc 2.17+ ARM64

polars_reverse_geocode-0.4.2-cp38-abi3-macosx_11_0_arm64.whl (5.3 MB view hashes)

Uploaded CPython 3.8+ macOS 11.0+ ARM64

polars_reverse_geocode-0.4.2-cp38-abi3-macosx_10_12_x86_64.whl (5.5 MB view hashes)

Uploaded CPython 3.8+ macOS 10.12+ x86-64

Supported by

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