本文整理汇总了C#中GeoCoordinate.ToGeoString方法的典型用法代码示例。如果您正苦于以下问题:C# GeoCoordinate.ToGeoString方法的具体用法?C# GeoCoordinate.ToGeoString怎么用?C# GeoCoordinate.ToGeoString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GeoCoordinate
的用法示例。
在下文中一共展示了GeoCoordinate.ToGeoString方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GeoCoordinateInitializerTest2
public void GeoCoordinateInitializerTest2()
{
var GeoCoordinate1 = new GeoCoordinate(new Latitude(-73.9874), new Longitude(0));
var b = GeoCoordinate1.ToGeoString(GeoFormat.Sexagesimal);
var c = GeoCoordinate.ParseString("49.44903° N, 11.07488° E");
var d = c.ToGeoString();
}
示例2: GeoCoordinateToStringAndBackParsingTest
public void GeoCoordinateToStringAndBackParsingTest()
{
var Random = new Random();
var RandomLatitude = new Latitude ((Random.NextDouble() - 0.5) * 180);
var RandomLongitude = new Longitude((Random.NextDouble() - 0.5) * 180);
var GeoCoordinate1 = new GeoCoordinate(RandomLatitude, RandomLongitude);
Assert.AreEqual(RandomLatitude.Value, GeoCoordinate1.Latitude.Value, 0.0000001);
Assert.AreEqual(RandomLongitude.Value, GeoCoordinate1.Longitude.Value, 0.0000001);
var GeoCoordinate2 = GeoCoordinate.ParseString(GeoCoordinate1.ToGeoString());
Assert.AreEqual(RandomLatitude.Value, GeoCoordinate2.Latitude.Value, 0.0000001);
Assert.AreEqual(RandomLongitude.Value, GeoCoordinate2.Longitude.Value, 0.0000001);
var GeoCoordinate3 = GeoCoordinate.ParseString(GeoCoordinate1.ToGeoString(GeoFormat.Decimal));
Assert.AreEqual(RandomLatitude.Value, GeoCoordinate3.Latitude.Value, 0.0000001);
Assert.AreEqual(RandomLongitude.Value, GeoCoordinate3.Longitude.Value, 0.0000001);
var GeoCoordinate4 = GeoCoordinate.ParseString(GeoCoordinate1.ToGeoString(GeoFormat.Sexagesimal));
Assert.AreEqual(RandomLatitude.Value, GeoCoordinate4.Latitude.Value, 0.0000001);
Assert.AreEqual(RandomLongitude.Value, GeoCoordinate4.Longitude.Value, 0.0000001);
var GeoCoordinate5 = GeoCoordinate.ParseString(RandomLatitude.ToString() + ", " + RandomLongitude.ToString());
Assert.AreEqual(RandomLatitude.Value, GeoCoordinate5.Latitude.Value, 0.0000001);
Assert.AreEqual(RandomLongitude.Value, GeoCoordinate5.Longitude.Value, 0.0000001);
}