Convert Coordinates
Contents
[
Hide
]
Aspose.GIS C# Library or API lets you calculate and parse a position in a variety of formats.
Convert in popular formats
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-gis/Aspose.GIS-for-.NET | |
var decimalDegrees = GeoConvert.AsPointText(25.5, 45.5, PointFormats.DecimalDegrees); | |
Console.WriteLine(decimalDegrees); | |
var degreeDecimalMinutes = GeoConvert.AsPointText(25.5, 45.5, PointFormats.DegreeDecimalMinutes); | |
Console.WriteLine(degreeDecimalMinutes); | |
var degreeMinutesSeconds = GeoConvert.AsPointText(25.5, 45.5, PointFormats.DegreeMinutesSeconds); | |
Console.WriteLine(degreeMinutesSeconds); | |
var geoRef = GeoConvert.AsPointText(25.5, 45.5, PointFormats.GeoRef); | |
Console.WriteLine(geoRef); | |
Parse position from text
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-gis/Aspose.GIS-for-.NET | |
if (GeoConvert.TryParsePointText("25.5°, 45.5°", out var point1)) | |
{ | |
Console.WriteLine("25.5°, 45.5° parsed as" + point1); | |
} | |
if (GeoConvert.TryParsePointText("25°30.00000', 045°30.00000'", out var point2)) | |
{ | |
Console.WriteLine("25°30.00000', 045°30.00000' parsed as" + point2); | |
} | |
if (GeoConvert.TryParsePointText("25°30'00.3000\", 045°30'00.3000\"", out var point3)) | |
{ | |
Console.WriteLine("25°30'00.3000\", 045°30'00.3000\" parsed as" + point3); | |
} | |
if (GeoConvert.TryParsePointText("RHAL30003000", out var point4)) | |
{ | |
Console.WriteLine("RHAL30003000 parsed as" + point4); | |
} |