turf
一个类似于 turf.js 的地理空间分析库,用于处理 GeoJSON,完全用 Dart 编写。
一个类似于 turf.js 的地理空间分析库,用于处理 GeoJSON,完全用 Dart 编写。
以下为英文项目原文快照,最新内容请访问 GitHub。
TurfDart is a Dart library for spatial analysis. It includes traditional spatial operations, helper functions for creating GeoJSON data, and data classification and statistics tools. You can use TurfDart in your Flutter applications on the web, mobile and desktop or in pure Dart applications running on the server.
As the foundation, we are using Geotypes, a lightweight dart library that provides a strong GeoJSON object model and fully RFC 7946 compliant serializers.
Most of the functionality is a translation from turf.js, the progress can be found here.
dart pub add turfimport 'package:turf/helpers.dart';
import 'package:turf/src/line_segment.dart';
Feature<Polygon> poly = Feature<Polygon>(
geometry: Polygon(coordinates: [
[
Position(0, 0),
Position(2, 2),
Position(0, 1),
Position(0, 0),
],
[
Position(0, 0),
Position(1, 1),
Position(0, 1),
Position(0, 0),
],
]),
);
void main() {
var total = segmentReduce<int>(
poly,
(previousValue, currentSegment, initialValue, featureIndex,
multiFeatureIndex, geometryIndex, segmentIndex) {
if (previousValue != null) {
previousValue++;
}
return previousValue;
},
0,
combineNestedGeometries: false,
);
print(total);
// total == 6
}
GeometryCollections (as described in
RFC 7946 section 3.1.8)
are not supported which takes a slightly firmer stance than the "should
avoid" language in the specificationTests are run with dart test and benchmarks can be run with
dart run benchmark
Any new benchmarks must be named *_benchmark.dart and reside in the
./benchmark folder.
依赖清单 12 项
^0.0.2^0.1.0^0.0.2^1.1.1^0.0.4^1.9.0^3.0.0^1.24.3^2.4.5^6.4.0^0.3.0^4.8.0先按使用场景筛选,再比较项目活跃情况,最后到原始仓库核对使用要求。
“A repository is the most basic element of GitHub.”
GitHub Docs — About repositories ↗