turf 0.0.9 copy "turf: ^0.0.9" to clipboard
turf: ^0.0.9 copied to clipboard

A turf.js-like geospatial analysis library working with GeoJSON, written in pure Dart.

example/main.dart

import '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
}
47
likes
130
pub points
94%
popularity

Publisher

verified publishergeometrico.dev

A turf.js-like geospatial analysis library working with GeoJSON, written in pure Dart.

Repository (GitHub)
View/report issues
Contributing

Documentation

API reference

License

MIT (license)

Dependencies

json_annotation, rbush, sweepline_intersections, turf_equality, turf_pip

More

Packages that depend on turf