Skip to content
Merged
Changes from all commits
Commits
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
10 changes: 9 additions & 1 deletion 1.0.2-draft/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,24 @@ A vector tile can consist of one or more named layers and containing one or more

Features contain an id, attributes, geometries (either point, linestring, or polygon) and an optional raster. It is expected that that either the `raster` field is set or the `geometry` field has repeated data, but not both.

### 3.1. Geometry Encoding

Geometries are stored as an a single array of integers that represent an command,x,y stream (where command is a rendering command like `move_to` or `line_to`). Commands are encoded only when they change.

Geometries with multiple parts (multipoint, multiline, or multipolygon) should be encoded one after another in the same `geometry` field and therefore are "flattened". Geometries with only a single part will have only a single `move_to` present. For multipoints and multilines a repeated `move_to` will indicate another part of a multipart geometry. For polygons a repeated `move_to` will indicate either either another exterior of a new polygon part or an interior ring of of the previous polygon part. The winding order should be used to distinguish between the two types: polygon interior rings (holes) must be oriented with the opposite winding order than their parent exterior rings and all interior rings must directly follow the exterior ring they belong too. Exterior rings must be oriented CCW and interior rings must be oriented CW (when viewed from the "top")
Geometries with multiple parts (multipoint, multiline, or multipolygon) should be encoded one after another in the same `geometry` field and therefore are "flattened". Geometries with only a single part will have only a single `move_to` present. For multipoints and multilines a repeated `move_to` will indicate another part of a multipart geometry. For polygons a repeated `move_to` will indicate either either another exterior of a new polygon part or an interior ring of of the previous polygon part. The winding order should be used to distinguish between the two types: polygon interior rings (holes) must be oriented with the opposite winding order than their parent exterior rings and all interior rings must directly follow the exterior ring they belong to.

The exterior ring shall have a positive area as calculated by applying the [surveyor's formula](https://en.wikipedia.org/wiki/Shoelace_formula) to the vertices of the polygon in tile coordinates. In screen coordinates (with the Y axis positive down) this makes the exterior ring's winding order appear clockwise. In a frame where the Y axis is positive up, this would make the winding order appear counter clockwise.

Geometry collections are not supported.

Geometries should be clipped, reprojected into spherical mercator, converted to screen coordinates, and [delta](http://en.wikipedia.org/wiki/Delta_encoding) and [zigzag](https://developers.google.com/protocol-buffers/docs/encoding#types) encoded.

### 3.2. Feature Attributes

Feature attributes are encoded as key:value pairs which are dictionary encoded at the layer level for compact storage of any repeated keys or values. Values use [variant](https://developers.google.com/protocol-buffers/docs/encoding#varints) type encoding supporting both unicode strings, boolean values, and various integer and floating point types.

### 3.3. Example

For example, a GeoJSON feature like:

```json
Expand Down