coordinate_converter 0.3.0 copy "coordinate_converter: ^0.3.0" to clipboard
coordinate_converter: ^0.3.0 copied to clipboard

Package for converting between UTM, DMS and DD coordinates in the WGS84 ellipsoid model

Coordinate Converter #

License: MIT style: very good analysis

A package for converting between UTM, DMS and DD coordinates in the WGS84 ellipsoid model.

  • UTM | Universal Transverse Mercator

  • DMS | - Degrees, Minutes and Seconds

  • DD | - Decimal Degrees

  • WGS-84 | Standart used in most maps such as Google Maps, Apple Maps, Mapbox, OpenStreetMaps, etc

The Universal Transverse Mercator - UTM coordinate system is explained on this Wikipedia page. The Geographic Coordinate System - GCS is explained on this Wikipedia page. The World Geodetic System and WGS84 are explained on this Wikipedia page.

Based on formulas from here.

Getting started #

Add dependency #

dependencies:
  coord_convert: 0.3.0

Usage #

Convert DD to DMS

import 'package:coordinate_converter/coordinate_converter.dart';
import 'package:flutter/material.dart';

// Create a DDCoordinates object
DDCoordinates ddCoordInput = DDCoordinates(
  latitude: -20.762535,
  longitude: -41.531941,
);

// call fromDD static method from DMSCoordinates
DMSCoordinates dmsCoords = DMSCoordinates.fromDD(ddCoordInput);

debugPrint('Output DMS: ${dmsCoords.toString()}');
// Print output of overridden toString method:
// flutter: Output DMS: 20° 45' 45.13 S" | 41° 31 54.99" W

Convert DMS to DD

// Create a DMSCoordinates object
DMSCoordinates dmsCoordInput = DMSCoordinates(
  latDegrees: 20,
  latMinutes: 45,
  latSeconds: 45.12540000,
  latDirection: DirectionY.south,
  lonDegrees: 41,
  lonMinutes: 31,
  lonSeconds: 54.98760000,
  lonDirection: DirectionX.west,
);

// call fromDMS static method from DDCoordinates
DDCoordinates ddCoords = DDCoordinates.fromDMS(dmsCoordInput);

debugPrint('Output DD: ${ddCoords.toString()}');
// Print output of overridden toString method:
// flutter: Output DD: -20.762534833333333, -41.531940999999996

Convert DD to UTM

// call fromDD static method from UTMCoordinates
UTMCoordinates utmCoord = UTMCoordinates.fromDD(ddCoordInput);

debugPrint('Output UTM: ${utmCoord.toString()}');
// Print output of overridden toString method:
// flutter: Output UTM: 24 S 236379.0 | 7702067.0

Contributing #

Pull requests are welcome.

7
likes
150
points
1.1k
downloads

Publisher

unverified uploader

Weekly Downloads

Package for converting between UTM, DMS and DD coordinates in the WGS84 ellipsoid model

Repository (GitHub)
View/report issues

License

MIT (license)

Dependencies

flutter

More

Packages that depend on coordinate_converter