Table of Contents

Struct GeoPosition

Namespace
Egami.Metadata
Assembly
Egami.dll

A position from the GPS tags of an EXIF block.

public readonly record struct GeoPosition : IEquatable<GeoPosition>
Implements
Inherited Members

Examples

using Raster photo = Raster.Load("sideways.jpg");
ExifData exif = photo.Metadata.Exif ?? new ExifData();

// Typed values go in with their EXIF type; fractions are exact numerator / denominator pairs.
exif.Set(ExifKey.ExposureTime, new ExifFraction(1, 250));
exif.Set(ExifKey.Artist, "A. Photographer");
if (exif.TryGet(ExifKey.ExposureTime, out ExifEntry? entry) && entry.Type == ExifType.Rational)
{
    Console.WriteLine($"Exposure {entry.AsFraction()} s = {entry.AsFraction().ToDouble()} s, in the {entry.Key.Ifd} IFD");
}

if (exif.Location is GeoPosition where)
{
    Console.WriteLine($"Taken at {where.Latitude:F5}, {where.Longitude:F5}");
}

Constructors

GeoPosition(double, double, double?)

A position from the GPS tags of an EXIF block.

public GeoPosition(double Latitude, double Longitude, double? Altitude)

Parameters

Latitude double

Degrees north, negative for south.

Longitude double

Degrees east, negative for west.

Altitude double?

Meters above sea level, negative below it, or null when the block has none.

Examples

using Raster photo = Raster.Load("sideways.jpg");
ExifData exif = photo.Metadata.Exif ?? new ExifData();

// Typed values go in with their EXIF type; fractions are exact numerator / denominator pairs.
exif.Set(ExifKey.ExposureTime, new ExifFraction(1, 250));
exif.Set(ExifKey.Artist, "A. Photographer");
if (exif.TryGet(ExifKey.ExposureTime, out ExifEntry? entry) && entry.Type == ExifType.Rational)
{
    Console.WriteLine($"Exposure {entry.AsFraction()} s = {entry.AsFraction().ToDouble()} s, in the {entry.Key.Ifd} IFD");
}

if (exif.Location is GeoPosition where)
{
    Console.WriteLine($"Taken at {where.Latitude:F5}, {where.Longitude:F5}");
}

Properties

Altitude

Meters above sea level, negative below it, or null when the block has none.

public double? Altitude { get; init; }

Property Value

double?

Latitude

Degrees north, negative for south.

public double Latitude { get; init; }

Property Value

double

Longitude

Degrees east, negative for west.

public double Longitude { get; init; }

Property Value

double