coordinate_converter

Creator: coderz1093

Last updated:

0 purchases

coordinate_converter Image
coordinate_converter Images

Languages

Categories

Add to Cart

Description:

coordinate converter

Coordinate Converter #







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.
Note: This package was inspired by sigam.
If you like this tool please star it on GitHub
Getting started #
Add dependency #
dependencies:
coord_convert: 1.1.1
copied to clipboard
Usage #
Create new instances of Coordinates objects
import 'package:coordinate_converter/coordinate_converter.dart';

// Decimal Degrees Coordinates
DDCoordinates ddCoords = DDCoordinates(
latitude: -20.762535,
longitude: -41.531941,
);

// Degrees, Minutes and Seconds Coordinates
DMSCoordinates dmsCoords = DMSCoordinates(
latDegrees: 20,
latMinutes: 45,
latSeconds: 45.12,
latDirection: DirectionY.south,
longDegrees: 41,
longMinutes: 31,
longSeconds: 54.98,
longDirection: DirectionX.west,
);

// Universal Transverse Mercator Coordinates
UTMCoordinates utmCoords = UTMCoordinates(
x: 236379,
y: 7702067,
zoneNumber: 24,
isSouthernHemisphere: true,
);
copied to clipboard

Convert to DD

// 1.1 DMS to DD
// Use static method
DDCoordinates convertedDDCoords = DDCoordinates.fromDMS(dmsCoords);
// OR
// Convert the current instance
convertedDDCoords = dmsCoords.toDD();

// 1.2 UTM to DD
// Use static method
convertedDDCoords = DDCoordinates.fromUTM(utmCoords);
// OR
// Convert the current instance
convertedDDCoords = utmCoords.toDD();

debugPrint('Output DD: ${convertedDDCoords.toString()}');
// Print output of overridden toString method:
// flutter: Output DD: -20.76253582021867, -41.53194825871451
copied to clipboard

Convert to DMS

// 2.1 DD to DMS
// Use static method
DMSCoordinates convertedDMSCoords = DMSCoordinates.fromDD(ddCoords);
// OR
// Convert the current instance
convertedDMSCoords = ddCoords.toDMS();

// 2.2 UTM to DMS
// Use static method
convertedDMSCoords = DMSCoordinates.fromUTM(utmCoords);
// OR
// Convert the current instance
convertedDMSCoords = utmCoords.toDMS();

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

Convert to UTM

// 3.1 DD to UTM
// Use static method
UTMCoordinates convertedUTMCoords = UTMCoordinates.fromDD(ddCoords);
// OR
// Convert the current instance
convertedUTMCoords = ddCoords.toUTM();

// 3.2 DMS to UTM
// Use static method
convertedUTMCoords = UTMCoordinates.fromDMS(dmsCoords);
// OR
// Convert the current instance
convertedUTMCoords = dmsCoords.toUTM();

debugPrint('Output UTM: ${convertedUTMCoords.toString()}');
// Print output of overridden toString method:
// flutter: Output UTM: 24 236379.75470806437 / 7702067.102859227 S
copied to clipboard
Fixed-point string with fixed decimal places

debugPrint(ddCoords.latitudeToStringAsFixed(2));
debugPrint(ddCoords.longitudeToStringAsFixed(4));
// flutter: -20.76
// flutter: -41.5319

debugPrint(dmsCoords.latitudeToStringAsFixed(4));
debugPrint(dmsCoords.longitudeToStringAsFixed(4));
// flutter: 20° 45' 45.1200"
// flutter: 41° 31' 54.9800"

debugPrint(utmCoords.xToStringAsFixed(5));
debugPrint(utmCoords.yToStringAsFixed(0));
// flutter: 236379.00000
// flutter: 7702067
copied to clipboard
Contributing #
🍺 Pull requests are welcome!
Don't forget that open-source makes no sense without contributors. No matter how big your changes are, it helps a lot even it is a line of change.
Reporting bugs and issues are contribution too, yes it is.
Donation #
Your donation motivates me to work more on the coordinate_converter and resolve issues.
There are multiple ways to donate:


You can be my sponsor on GitHub


If you are a fan of crypto, you can donate me Bitcoins here: 1HhHqNQyJctrcwcYzUE8SrB3b3TVcNVx5P


Or you just:

License

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.