FLUTTER ECOSYSTEM

dartclub/turf_dart

GeoJSON과 함께 작동하는 turf.js와 유사한 지리공간 분석 라이브러리로, 순수 Dart로 작성되었습니다.

turf_dart 프로젝트 이미지
Stars
83
Forks
35
최근 푸시(UTC)
2026. 9. 16.
프로젝트 상태
활성
Dart Club GitHub avatar
GITHUB Organization

Dart Club ↗

Dart Language rocks! Flutter too btw. – Dart Club ~ Established 2018 –

Germany
언어DartShell

기술 주제

이 저장소가 배포한 패키지

사용 중인 의존성

의존성 목록 12 개

원본 README

아래는 영문 원문 스냅샷입니다. 최신 내용은 GitHub에서 확인하세요.

README 펼치기 / 접기


TurfDart Logo

A TurfJs-like geospatial analysis library written in pure Dart.


pub package dart unit tests dart publish License: MIT

–> Join our Dart / Flutter GIS Community on Discord <–

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.

Get started

  • Get the Dart tools
  • Install the library with dart pub add turf
  • Import the library in your code and use it. For example:
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
}

GeoJSON Object Model

polymorphism

Notable Design Decisions
  • Nested 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 specification

Tests and Benchmarks

Tests 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.