s2geometry 0.1.1

  • Readme
  • Changelog
  • Example
  • Installing
  • 65

dart_s2geometry #

Dart port of the C++ s2geometry and Go geo libraries.

Usage #

A simple usage example:

import 'package:s2geometry/s2geometry.dart';

main() {
  S2LatLng latLng = new S2LatLng.fromDegrees(49.703498679, 11.770681595);
  S2CellId cellId = new S2CellId.fromLatLng(latLng);
  print(cellId.toToken());
}

Notes #

This library depends on int being a 64 bit signed integer, and thus may not work under JavaScript targets.

Features and bugs #

Please file feature requests and bugs at the issue tracker.

0.1.1 #

  • Create S2CellId from S2LatLng
  • Make S2CellId token
  • Get parent levels of S2CellId

example/s2geometry_example.dart

import 'package:s2geometry/s2geometry.dart';

main() {
  S2LatLng latLng = new S2LatLng.fromDegrees(49.703498679, 11.770681595);
  S2CellId cellId = new S2CellId.fromLatLng(latLng);
  print(cellId.toToken());
}

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  s2geometry: ^0.1.1

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter pub get

Alternatively, your editor might support pub get or flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:s2geometry/s2geometry.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
60
Health:
Code health derived from static analysis. [more]
81
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
53
Overall:
Weighted score of the above. [more]
65
Learn more about scoring.

We analyzed this package on Dec 7, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.6.1
  • pana: 0.12.21

Platforms

Detected platforms: Flutter, web, other

No platform restriction found in primary library package:s2geometry/s2geometry.dart.

Health issues and suggestions

Document public APIs. (-0.43 points)

51 out of 52 API elements have no dartdoc comment.Providing good documentation for libraries, classes, functions, and other API elements improves code readability and helps developers find and use your API.

Fix lib/src/s2cell_id.dart. (-9.54 points)

Analysis of lib/src/s2cell_id.dart reported 20 hints, including:

line 29 col 11: The declaration '_kFaceBits' isn't referenced.

line 30 col 11: The declaration '_kNumFaces' isn't referenced.

line 36 col 25: Unnecessary new keyword.

line 37 col 24: Unnecessary new keyword.

line 88 col 11: Unnecessary new keyword.

Fix lib/src/s2latlng.dart. (-4.41 points)

Analysis of lib/src/s2latlng.dart reported 9 hints, including:

line 28 col 50: Unnecessary new keyword.

line 29 col 34: Unnecessary new keyword.

line 30 col 31: Unnecessary new keyword.

line 31 col 60: Unnecessary new keyword.

line 32 col 60: Unnecessary new keyword.

Fix lib/src/s2coords.dart. (-2.96 points)

Analysis of lib/src/s2coords.dart reported 6 hints, including:

line 41 col 5: DO use curly braces for all flow control structures.

line 43 col 5: DO use curly braces for all flow control structures.

line 48 col 5: DO use curly braces for all flow control structures.

line 50 col 5: DO use curly braces for all flow control structures.

line 91 col 17: Unnecessary new keyword.

Fix additional 4 files with analysis or formatting issues. (-2.99 points)

Additional issues in the following files:

  • lib/src/s1angle.dart (3 hints)
  • lib/src/s2point.dart (2 hints)
  • lib/src/r2point.dart (1 hint)
  • lib/src/util/bits/bits.dart (Run dartfmt to format lib/src/util/bits/bits.dart.)

Maintenance suggestions

Package is getting outdated. (-27.40 points)

The package was last published 66 weeks ago.

The package description is too short. (-20 points)

Add more detail to the description field of pubspec.yaml. Use 60 to 180 characters to describe the package, what it does, and its target use case.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0 <3.0.0
Dev dependencies
test ^1.0.0