Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
c346cd0
Custom package for pypi.mappy.priv
Nov 15, 2016
601ef8a
Moving to lib protobuf compiled by mappy in order to have python cpp …
Nov 15, 2016
379eb72
Bumping version number
Nov 15, 2016
101f406
Fixed multipolygon encoding and test
Nov 25, 2016
38f45cd
Modified Init to match Flake8 specs
Nov 15, 2016
e4660e7
Bumped version
Jan 5, 2017
0823a09
Upgrading protobuf version
smounir Oct 4, 2018
113beef
Unfix protobuf version
smounir Oct 8, 2018
195c612
Using compiled protobuf version 3.0.2 stored on mappy pypi
smounir Oct 9, 2018
7f8a002
Reverting using compiled protobuf version 3.0.2
smounir Oct 9, 2018
a1557ed
Upgrade version
smounir Oct 9, 2018
93e1072
upgrade version
Mar 7, 2019
ab8f4f8
add p3 compatibility with protobuf3 and upgrade version
Mar 25, 2019
f91b223
MAP-3297 setting mapbox-vector-tile compatible with vector_tile_base …
StephenKinger Nov 27, 2020
9d908af
upgrade python 3.13
Jul 4, 2025
c2abf2e
test
Jul 7, 2025
0de3334
force version of protobuf as in tkvecto
Jul 7, 2025
93bee4e
Merge remote-tracking branch 'refs/remotes/origin/feature/upgrade_pyt…
Jul 7, 2025
5419957
add twine in dependancies
Jul 7, 2025
af0384b
[MAP-8979] upgrade python 3.13
Jul 29, 2025
95cc8cc
Merge branch 'feature/upgrade_python_3.13' of github.com:Mappy/mapbox…
Jul 29, 2025
4334257
[MAP-8979] fix setup and requirements.txt
Jul 29, 2025
a4b584d
[MAP-8979] fix setup
Jul 29, 2025
c3d525a
[MAP-8979] fix setup
Jul 29, 2025
224807f
upgrade tests
Aug 1, 2025
c0e0a14
upgrade version
Aug 1, 2025
4a76782
try to fix build package
Aug 1, 2025
0adf459
trying to build a good wheel
Aug 1, 2025
9c6efc3
regenerate py file from new proto file to use >4.10 protobuf
Aug 4, 2025
60dd57c
upgrade lib version
Aug 4, 2025
5355a13
regenerate with protoc
Aug 4, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
dist/
build/
*.pyc
mapbox_vector_tile.egg-info/
mapbox_vector_tile.egg-info/
.idea/
3 changes: 2 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ python:
install:
- pip install flake8
- pip install coveralls
- python setup.py install
- pip install build
- python -m build
script:
- find mapbox_vector_tile tests -type f -name "*.py" -not -path "*/Mapbox/*" | xargs flake8
- coverage run --source=mapbox_vector_tile setup.py test
Expand Down
22 changes: 21 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,26 @@ Mapbox Vector Tile
[![Build Status](https://travis-ci.org/tilezen/mapbox-vector-tile.svg?branch=master)](https://travis-ci.org/tilezen/mapbox-vector-tile)
[![Coverage Status](https://coveralls.io/repos/github/tilezen/mapbox-vector-tile/badge.svg?branch=master)](https://coveralls.io/github/tilezen/mapbox-vector-tile?branch=master)


## For compatibility with protobuf 4.21.1
Regenerate the protobuf files from the protobuf definitions.

Get the right version of protoc

```bash
PB_REL="https://github.com/protocolbuffers/protobuf/releases"
curl -LO $PB_REL/download/v22.1/protoc-22.1-linux-x86_64.zip
unzip protoc-22.1-linux-x86_64.zip
```


```bash
cd mapbox_vector_tile/Mapbox/proto
../../../bin/protoc --python_out=. vector_tile_p3.proto
mv vector_tile_p3_p2.py ../
```


Installation
------------

Expand All @@ -20,7 +40,7 @@ Encoding

Encode method expects an array of layers or atleast a single valid layer. A valid layer is a dictionary with the following keys

* `name`: layer name
* `name`: layer name
* `features`: an array of features. A feature is a dictionary with the following keys:

* `geometry`: representation of the feature geometry in WKT, WKB, or a shapely geometry. Coordinates are relative to the tile, scaled in the range `[0, 4096)`. See below for example code to perform the necessary transformation. *Note* that `GeometryCollection` types are not supported, and will trigger a `ValueError`.
Expand Down
94 changes: 94 additions & 0 deletions mapbox_vector_tile/Mapbox/proto/vector_tile_p3.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
// Protocol Version 1

syntax = "proto2";

package mapnik.vector;

option optimize_for = LITE_RUNTIME;

message tile {
enum GeomType {
Unknown = 0;
Point = 1;
LineString = 2;
Polygon = 3;
}

// Variant type encoding
message value {
// Exactly one of these values may be present in a valid message
optional string string_value = 1;
optional float float_value = 2;
optional double double_value = 3;
optional int64 int_value = 4;
optional uint64 uint_value = 5;
optional sint64 sint_value = 6;
optional bool bool_value = 7;

extensions 8 to max;
}

message feature {
optional uint64 id = 1;

// Tags of this feature. Even numbered values refer to the nth
// value in the keys list on the tile message, odd numbered
// values refer to the nth value in the values list on the tile
// message.
repeated uint32 tags = 2 [ packed = true ];

// The type of geometry stored in this feature.
optional GeomType type = 3 [ default = Unknown ];

// Contains a stream of commands and parameters (vertices). The
// repeat count is shifted to the left by 3 bits. This means
// that the command has 3 bits (0-7). The repeat count
// indicates how often this command is to be repeated. Defined
// commands are:
// - MoveTo: 1 (2 parameters follow)
// - LineTo: 2 (2 parameters follow)
// - ClosePath: 7 (no parameters follow)
//
// Ex.: MoveTo(3, 6), LineTo(8, 12), LineTo(20, 34), ClosePath
// Encoded as: [ 9 3 6 18 5 6 12 22 15 ]
// == command type 7 (ClosePath), length 1
// ===== relative LineTo(+12, +22) == LineTo(20, 34)
// === relative LineTo(+5, +6) == LineTo(8, 12)
// == [00010 010] = command type 2 (LineTo), length 2
// === relative MoveTo(+3, +6)
// == [00001 001] = command type 1 (MoveTo), length 1
// Commands are encoded as uint32 varints, vertex parameters are
// encoded as sint32 varints (zigzag). Vertex parameters are
// also encoded as deltas to the previous position. The original
// position is (0,0)
repeated uint32 geometry = 4 [ packed = true ];
}

message layer {
// Any compliant implementation must first read the version
// number encoded in this message and choose the correct
// implementation for this version number before proceeding to
// decode other parts of this message.
required uint32 version = 15 [ default = 1 ];

required string name = 1;

// The actual features in this tile.
repeated feature features = 2;

// Dictionary encoding for keys
repeated string keys = 3;

// Dictionary encoding for values
repeated value values = 4;

// The bounding box in this tile spans from 0..4095 units
optional uint32 extent = 5 [ default = 4096 ];

extensions 16 to max;
}

repeated layer layers = 3;

extensions 16 to 8191;
}
39 changes: 39 additions & 0 deletions mapbox_vector_tile/Mapbox/vector_tile_p3_pb2.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading