Skip to content

Vectorized functions that allow efficient transformation of latitude and longitude coordinates into Map Tile coordinates, Map Pixel coordinates or QuadKeys

License

Notifications You must be signed in to change notification settings

wsk170/vec_geohash

 
 

Repository files navigation

Vec_GeoHash

Python License: MIT Tests Ruff

Short Description

Vectorized functions that allow efficient transformation of latitude and longitude coordinates into Map Tile coordinates, Map Pixel coordinates or QuadKeys. This can be particularly useful in (GIS) geographic information systems and mapping applications. By utilizing vectorized functions, transformation can be performed on large datasets, with minimal impact on performance. Additionally, only using numpy as dependency these functions can be easily incorporated into existing code and workflows.

Instalation

The project can be installed using `pip`:

pip install vec_geohash

To install from this repo:

git clone https://github.com/FJakovljevic/vec_geohash.git
cd vec_geohash
pip install -e .

Usage

Vector example

import vec_geohash

lat_vector = [53.1231276599, 41.85]
lon_vector = [82.6978699112, -87.65]
zoom = 9

# getting tiles as [tile_x] vector and [tile_y] vector
vec_geohash.lat_lon_to_tile(lat_vector, lon_vector, zoom)
>>> (array([373, 131]), array([166, 190]))

# getting tiles as [[tile_x, tile_y]] vector
vec_geohash.lat_lon_to_tile(lat_vector, lon_vector, zoom)
>>> array([[373, 166],
           [131, 190]])

# getting quadkey
vec_geohash.lat_lon_to_quadkey(lat_vector, lon_vector, zoom)
>>> array(['121310321', '030222231'], dtype='<U9')

# getting pixels as [pixel_x] vector and [pixel_y] vector
vec_geohash.lat_lon_to_pixel(lat_vector, lon_vector, zoom)
>>> (array([95645, 33623]), array([42622, 48729]))

# getting pixels as [[pixel_x, pixel_y]] vector
vec_geohash.lat_lon_to_pixel(lat_vector, lon_vector, zoom)
>>> array([[95645, 42622],
           [33623, 48729]])

Scalar example

import vec_geohash

lat = 53.1231276599
lon = 82.6978699112
zoom = 9

# getting tiles 
vec_geohash.lat_lon_to_tile(lat, lon, zoom)
>>> (373, 166)

# getting quadkey
vec_geohash.lat_lon_to_quadkey(lat, lon, zoom)
>>> array(['121310321'], dtype='<U9')

# getting pixels
vec_geohash.lat_lon_to_pixel(lat, lon, zoom)
>>> (95645, 42622)

About

Vectorized functions that allow efficient transformation of latitude and longitude coordinates into Map Tile coordinates, Map Pixel coordinates or QuadKeys

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%