Projections
Besides the Coordinates
class, the Maps SDK for Flutter provides a Projection
class that represents the base class for different geocoordinate systems such as:
WGS84
(World Geodetic System 1984)GK
(Gauss-Kruger)UTM
(Universal Transverse Mercator)LAM
(Lambert)BNG
(British National Grid)MGRS
(Military Grid Reference System)W3W
(What three words)
To know the type of the Projection
you can use the type
getter:
final type = projection.type;
WGS84 Projection
The WGS84
projection is a widely used geodetic datum that serves as the foundation for GPS and other mapping systems. It provides a standard reference frame for the Earth's surface, allowing for accurate positioning and navigation. A WGS84
projection can be instantiated using a Coordinates
object:
final obj = WGS84Projection(Coordinates(latitude: 5.0, longitude: 5.0));
Then, the coordinates can be accessed and set using the coordinates
getter and setter:
final coordinates = obj.coordinates; // Get coordinates
obj.coordinates = Coordinates(latitude: 10.0, longitude: 10.0); // Set coordinates
The coordinates getter returns null if the coordinates are not set.
GK Projection
The Gauss-Kruger
projection is a cylindrical map projection that is commonly used for large-scale mapping in regions with a north-south orientation. It divides the Earth into zones, each with its own coordinate system, allowing for accurate representation of geographic features. A Gauss-Kruger
projection can be instantiated using the following constructor:
final obj = GKProjection(x: 6325113.72, y: 5082540.66, zone: 1);
In order to obtain the x, y and zone values, the easting
, northing
and zone
getters can be used, while setting them can be done using the setFields
method:
final obj = GKProjection(x: 6325113.72, y: 5082540.66, zone: 1);
final type = obj.type; // ProjectionType.gk
final zone = obj.zone; // 1
final easting = obj.easting; // 6325113.72
final northing = obj.northing; // 5082540.66
obj.setFields(x: 1, y: 1, zone: 2);
final newZone = obj.zone; // 2
final newEasting = obj.easting; // 1
final newNorthing = obj.northing; // 1
The Gauss-Kruger
projection is currently supported only for countries that use Bessel ellipsoid. Trying to convert to and from Gauss-Kruger
projection for other countries will result in a GemError.notSupported
error.