Skip to main content

A collection of tools for navigating Mapbox tiles.

Project description

Tile Tools

Python Tests Python Lint

Collection of tools useful for navigating Mapbox (and similar) tiles.

Most of these tools were written by Mapbox in JavaScript. I've ported them into Python with minimal modification.

Contents

tilebelt

Utility functions for working with tiles.

This is a complete Python port of Mapbox's @mapbox/tilebelt.

There are some minor differences in the API. See the submodule readme for more details.

cover

Given a GeoJSON Geometry and a zoom level, generate the minimal set of Mapbox (x, y, zoom) tiles that cover this geometry.

This is a re-implementation of Mapbox's @mapbox/tile-cover. The implementation started out as a port, however the originally library is not passing all of its own tests. The API has been re-implemented here with a slightly different approach, and all of the equivalent tests are now passing.

See submodule readme for details.

coords

coords.tilecoords2lnglat

Transform Mapbox's relative tile (x, y) coordinates into longitude/latitude degrees.

distance

distance.haversine

Compute the distance between two points on the globe using the haversine formula.

Development

Set up the environment with poetry:

poetry install --with dev
poetry run pre-commit install

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

tile_tools-0.1.0.tar.gz (14.9 kB view hashes)

Uploaded Source

Built Distribution

tile_tools-0.1.0-py3-none-any.whl (19.0 kB view hashes)

Uploaded Python 3

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