geopointer

A lightweight flutter library for common latitude and longitude calculation..

Getting Started


GeoPointer provides a lightweight library for common latitude and longitude calculation.

This library supports both, the "Haversine" and the "Vincenty" algorithm.

"Haversine" is a bit faster but "Vincenty" is far more accurate!

Basic usage

Distance

    final Distance distance = new Distance();

    //in km = 423
    final int km = distance.as(LengthUnit.Kilometer,
     new LatLng(52.518611,13.408056),new LatLng(51.519475,7.46694444));

    //in meter = 422591.551
    final int meter = distance(
        new LatLng(52.518611,13.408056),
        new LatLng(51.519475,7.46694444)
        );

Offset

    final Distance distance = const Distance();
    final num distanceInMeter = (EARTH_RADIUS * math.PI / 4).round();

    final p1 = new LatLng(0.0, 0.0);
    final p2 = distance.offset(p1, distanceInMeter, 180);

    // LatLng(latitude:-45.219848, longitude:0.0)
    print(p2.round());

    // 45° 13' 11.45" S, 0° 0' 0.00" O
    print(p2.toSexagesimal());

Path smoothing

    // coordinates is a list of coordinates
    final Path path = new Path.from(coordinates);

    // Result is below
    final Path steps = path.equalize(8,smoothPath: true);