Skip to main content

Create geojson-tiles from gpx or geojson using tippecanoe (C++) and togeojson (javascript)

Project description

PyPI version
Create geojson-tiles from gpx, mbtiles or geojson files.

togeojsontiles is a Python 3 package with bindings for tippecanoe (C++) and togeojson (javascript) that allows to create geojson vector tiles, tiles/{z}/{x}/{y}.geojson, from gpx, mbtiles or geojson files.

The tiles allow to display large amounts of vector data on interactive maps without losing performance.

The generated tiles can be shown on interactive slippy map like OpenLayers and Leaflet.

Installation

togeojsontiles is compatible with Python 3.3, 3.4, 3.5. It is listed on PyPi as ‘togeojsonfiles’.
The recommended way to install is via pip,
$ pip install togeojsontiles

Dependencies

This package provides Python bindings for tippecanoe (C++) to create the tiles, and togeojson (javascript) to convert gpx to geojson. These libraries do all the work and are required.

tippecanoe

See tippecanoe for installation instructions. It has a few system level dependencies, but is rather easy to build.

togoejson

To install togoejson (javascript) in your path,

$ npm install -g togeojson

Usage

gpx to geojson

import togeojsontiles

togeojsontiles.gpx_to_geojson(file_gpx='test.gpx', file_geojson='test.geojson')

geojson to mbtiles

import togeojsontiles

TIPPECANOE_DIR = '/usr/local/bin/'

togeojsontiles.geojson_to_mbtiles(
    filepaths=['./data/test1.geojson', './data/test2.geojson'],
    tippecanoe_dir=TIPPECANOE_DIR,
    mbtiles_file='out.mbtiles',
    maxzoom=14
)

mbtiles to geojson-tiles

import togeojsontiles

TIPPECANOE_DIR = '/usr/local/bin/'

togeojsontiles.mbtiles_to_geojsontiles(
  tippecanoe_dir=TIPPECANOE_DIR,
  tile_dir='project/data/tiles/',
  mbtiles_file='out.mbtiles'
)

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

togeojsontiles-0.1.2.tar.gz (3.4 kB view details)

Uploaded Source

File details

Details for the file togeojsontiles-0.1.2.tar.gz.

File metadata

File hashes

Hashes for togeojsontiles-0.1.2.tar.gz
Algorithm Hash digest
SHA256 3d57d139a40be4185e2a5324444e141ccf8d12e33727033dd848fbf8e2883763
MD5 49116157ab209827549226c475b8e78e
BLAKE2b-256 0fb28164d868eaf649d9884361c61e868a93cece5258c58cb81dd2e5bb57ec78

See more details on using hashes here.

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