Skip to content

bahung1221/dart-vector-tile-query

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Dart Vector Tile Query

A Dart package to query reverse geocoding on a set of vector tile protobuf files (pbf or mvt). Using vector tiles that were parsed by dart-vector-tile.

Features:

  • Get a list of the features closest to a query point.
  • Get polygons that contain a point (radius=0).

Sample usage

import 'package:vector_tile_query/vector_tile_query.dart';

List<QueryTile> tiles = [
    QueryTile(
        tile: await VectorTile.fromPath(path: '../data/13-6525-3847.pbf'),
        x: 6525,
        y: 3847,
        z: 13,
    ),
    QueryTile(
        tile: await VectorTile.fromPath(path: '../data/13-6525-3848.pbf'),
        x: 6525,
        y: 3848,
        z: 13,
    ),
];

ReverseQueryOption option = ReverseQueryOption(
    radius: 20,
    limit: 10,
    geometryTypes: [VectorTileGeomType.POINT],
    layers: ['poi', 'housenumber', 'building', 'park'],
    dedupe: true,
);

List<double> point = [
    106.75985276699066,
    10.844338677301536
]; // lon - lat

var result = reverseQuery(point: point, queryTiles: tiles, option: option);

Result item structure:

class ResultItem {
  GeoJson geoJson; // GeoJson data
  VectorTileFeature feature; // Raw vector tile feature data
  double distance; // Distance to query point
}

Example use cases:

Reverse geocoding to find housenumber, road, suburb and city of a point by given a set of satisfy tiles:


Get polygons that contain a point:

Releases

No releases published

Packages

No packages published

Languages