vector_tile 0.0.1 copy "vector_tile: ^0.0.1" to clipboard
vector_tile: ^0.0.1 copied to clipboard

outdated

A simple Dart package to encode & decode Mapbox Vector Tile, it refers to a specification developed by MapBox (https://github.com/mapbox/vector-tile-spec).

Dart Vector Tile #

Simple package to encode & decode vector tiles. based on Mapbox Vector Tile specification 2.1.

Decode #

Decode an vector tile file, either .pbf or .mvt should work:

import 'vector_tile/vector_tile.dart';

main() async {
    VectorTile tile = await decodeVectorTile(path: './data/14-13050-7695.pbf');
}

Sample VectorTile fields

Encode #

Create VectorTile and then encode it into protobuf file:

import 'vector_tile/vector_tile.dart';

main() async {
    var values = [
        createVectorTileValue(intValue: Int64(65)),
        createVectorTileValue(stringValue: 'basketball'),
    ];

    var features = [
        createVectorTileFeature(
            id: Int64(31162829580),
            tags: [0, 96, 1, 348],
            type: VectorTile_GeomType.POINT,
            geometry: [9, 8058, 1562],
        ),
    ];

    var layers = [
        createVectorTileLayer(
            name: 'building',
            extent: 4096,
            version: 2,
            keys: ['render_height', 'render_min_height'],
            values: values,
            features: features,
        ),
    ];

    var tile = createVectorTile(layers: layers);

    // Save to disk
    await encodeVectorTile(path: './gen/tile.pbf', tile: tile);
}

Sample VectorTile fields (As JSON): #

{
    "layers": {
        "name": "building",
        "features": [{
            "id": 31162829580,
            "tags": [0, 96, 1, 348],
            "type": "POINT",
            "geometry": [9, 8058, 1562]
        }],
        "keys": ["render_height", "render_min_height"],
        "values": [
            {
                "intValue": 65
            },
            {
                "stringValue": "basketball"
            }
        ],
        "extent": 4096,
        "version": 2
    }
}
6
likes
0
pub points
66%
popularity

Publisher

unverified uploader

A simple Dart package to encode & decode Mapbox Vector Tile, it refers to a specification developed by MapBox (https://github.com/mapbox/vector-tile-spec).

Repository (GitHub)
View/report issues

Documentation

Documentation

License

unknown (LICENSE)

Dependencies

fixnum, meta, protobuf

More

Packages that depend on vector_tile