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

GDistance

    final GDistance distance = new GDistance();

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

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

Offset

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

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

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

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

GeoPath smoothing

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

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

Libraries

expect
geopointer
gspline
gvalidate