1
1
# rio-tiler-mvt
2
2
3
- [ ![ Packaging status] ( https://badge.fury.io/py/rio-tiler-mvt.svg )] ( https://badge.fury.io/py/rio-tiler-mvt )
4
- [ ![ CircleCI] ( https://circleci.com/gh/cogeotiff/rio-tiler-mvt.svg?style=svg )] ( https://codecov.io/gh/cogeotiff/rio-tiler-mvt )
5
- [ ![ codecov] ( https://codecov.io/gh/cogeotiff/rio-tiler-mvt/branch/master/graph/badge.svg )] ( https://circleci.com/gh/cogeotiff/rio-tiler-mvt )
3
+ <p align =" center " >
4
+ <img src =" https://user-images.githubusercontent.com/10407788/57476379-72cf6000-7264-11e9-979d-bf9f486518c2.png " style =" max-width : 800px ;" alt =" rio-tiler " ></a >
5
+ </p >
6
+ <p align =" center " >
7
+ <em >A rio-tiler plugin to translate tile array to MVT (using python-vtzero).</em >
8
+ </p >
9
+ <p align =" center " >
10
+ <a href =" https://github.com/cogeotiff/rio-tiler-mvt/actions?query=workflow%3ACI " target =" _blank " >
11
+ <img src="https://github.com/cogeotiff/rio-tiler-mvt/workflows/CI/badge.svg" alt="Test">
12
+ </a >
13
+ <a href =" https://codecov.io/gh/cogeotiff/rio-tiler-mvt " target =" _blank " >
14
+ <img src="https://codecov.io/gh/cogeotiff/rio-tiler-mvt/branch/master/graph/badge.svg" alt="Coverage">
15
+ </a >
16
+ <a href =" https://pypi.org/project/rio-tiler-mvt " target =" _blank " >
17
+ <img src="https://img.shields.io/pypi/v/rio-tiler-mvt?color=%2334D058&label=pypi%20package" alt="Package version">
18
+ </a >
19
+ <a href =" https://github.com/cogeotiff/rio-tiler-mvt/blob/master/LICENSE " target =" _blank " >
20
+ <img src="https://img.shields.io/github/license/cogeotiff/rio-tiler-mvt.svg" alt="Downloads">
21
+ </a >
22
+ </p >
6
23
7
24
8
- A rio-tiler plugin to translate tile array to MVT (using python-vtzero)
9
-
10
- ![ ] ( https://user-images.githubusercontent.com/10407788/57476379-72cf6000-7264-11e9-979d-bf9f486518c2.png )
11
-
12
25
More on [ COG Talk] ( https://medium.com/devseed/search?q=cog%20talk ) blog posts
13
26
14
27
## Install
@@ -22,7 +35,7 @@ $ pip install cython~=0.28 # see https://github.com/tilery/python-vtzero#require
22
35
23
36
$ pip install rio-tiler-mvt
24
37
```
25
- Or
38
+ Or
26
39
``` bash
27
40
$ git clone https://github.com/cogeotiff/rio-tiler-mvt
28
41
$ cd rio-tiler-mvt
@@ -33,14 +46,53 @@ $ pip install -e .
33
46
34
47
### API
35
48
36
- ` mvt.encoder(data, mask, band_names=[], layer_name="my_layer", feature_type="point") `
49
+ #### ** pixel_encoder**
50
+
51
+ pixels_encoder(
52
+ data: numpy.ndarray,
53
+ mask: numpy.ndarray,
54
+ band_names: list = [],
55
+ layer_name: str = "my_layer",
56
+ feature_type: str = "point"
57
+ )
58
+
59
+ Inputs:
60
+ - data: raster tile data to encode
61
+ - mask: mask data
62
+ - band_names: Raster band's names
63
+ - layer_name: Layer name
64
+ - feature_type: Feature type (point or polygon)
65
+
66
+ Returns:
67
+ - mvt : Mapbox Vector Tile encoded data.
68
+
69
+ Examples:
70
+
71
+ ``` python
72
+ from rio_tiler.io import COGReader
73
+ from rio_tiler_mvt import pixels_encoder
74
+
75
+ with COGReader(" fixtures/test.tif" ) as cog
76
+ img = cog.tile(72 , 63 , 7 , resampling_method = " nearest" )
77
+ mvt = pixels_encoder(img.data, img.mask, layer_name = " test" , feature_type = " point" )
78
+ ```
79
+
80
+ #### ** shapes_encoder**
81
+
82
+ shapes_encoder(
83
+ data: numpy.ndarray, # 1D array (height, width)
84
+ mask: numpy.ndarray,
85
+ layer_name: str = "my_layer",
86
+ colormap: dict = {},
87
+ class_names: dict = {}
88
+ )
37
89
38
90
Inputs:
39
- - data : raster tile data to encode
40
- - mask : mask data
41
- - band_names : Raster band's names
42
- - layer_name : Layer name
43
- - feature_type : Feature type (point or polygon)
91
+ - data: raster tile data to encode
92
+ - mask: mask data
93
+ - layer_name: Layer name
94
+ - colormap: GDAL colormap. If provided a ` color ` value will be added to the feature properties
95
+ - class_names: Dictionary mapping pixel value with class names. If provided a ` name ` value will be added to the feature properties.
44
96
45
97
Returns:
46
98
- mvt : Mapbox Vector Tile encoded data.
@@ -58,16 +110,12 @@ $ cd rio-tiler-mvt
58
110
$ pip install -e .[dev]
59
111
```
60
112
61
- ** Python3.6 only**
113
+ ** Python3.7 only**
62
114
63
- This repo is set to use ` pre-commit ` to run * flake8* , * pydocstring* and * black* ("uncompromising Python code formatter") when commiting new code.
115
+ This repo is set to use ` pre-commit ` to run * isort * , * flake8* , * pydocstring* , * black* ("uncompromising Python code formatter") and mypy when committing new code.
64
116
65
117
``` bash
66
118
$ pre-commit install
67
119
```
68
120
69
-
70
- ## Implementations
71
- [ cogeo-mosaic] ( https://github.com/developmentseed/cogeo-mosaic.git )
72
-
73
- [ satellite-3d] ( https://github.com/developmentseed/satellite-3d.git )
121
+ [ satellite-3d] ( https://github.com/developmentseed/satellite-3d.git )
0 commit comments