本文整理汇总了C#中GeoCoordinate.ToGeoHash32方法的典型用法代码示例。如果您正苦于以下问题:C# GeoCoordinate.ToGeoHash32方法的具体用法?C# GeoCoordinate.ToGeoHash32怎么用?C# GeoCoordinate.ToGeoHash32使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GeoCoordinate
的用法示例。
在下文中一共展示了GeoCoordinate.ToGeoHash32方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ToGeoHashTest2
public void ToGeoHashTest2()
{
var geo01 = new GeoCoordinate(new Latitude(38.897), new Longitude(-77.036));
var geo01hash = geo01.ToGeoHash(20);
var geo01hash32 = geo01.ToGeoHash32(16);
var geo01hash64 = geo01.ToGeoHash64(32);
Assert.AreEqual("dqcjr0bp7n74cjbuqqub", geo01hash.Value);
Assert.AreEqual(2590713666U, geo01hash32.Value);
Assert.AreEqual(11127030471626460554UL, geo01hash64.Value);
var geo01rev = geo01hash.ToGeoCoordinate(3);
var geo01rev32 = geo01hash.ToGeoCoordinate(3);
var geo01rev64 = geo01hash.ToGeoCoordinate(3);
Assert.IsTrue(geo01.Equals(geo01rev));
Assert.IsTrue(geo01 == geo01rev);
Assert.AreEqual(geo01.Latitude.Value, geo01rev.Latitude.Value, 0.000001);
Assert.AreEqual(geo01.Longitude.Value, geo01rev.Longitude.Value, 0.000001);
Assert.IsTrue(geo01.Equals(geo01rev32));
Assert.IsTrue(geo01 == geo01rev32);
Assert.AreEqual(geo01.Latitude.Value, geo01rev32.Latitude.Value, 0.000001);
Assert.AreEqual(geo01.Longitude.Value, geo01rev32.Longitude.Value, 0.000001);
Assert.IsTrue(geo01.Equals(geo01rev64));
Assert.IsTrue(geo01 == geo01rev64);
Assert.AreEqual(geo01.Latitude.Value, geo01rev64.Latitude.Value, 0.000001);
Assert.AreEqual(geo01.Longitude.Value, geo01rev64.Longitude.Value, 0.000001);
}
示例2: ToGeoHashTest3
public void ToGeoHashTest3()
{
var geo01 = new GeoCoordinate(new Latitude(-38.897), new Longitude(-77.036));
var geo01hash = geo01.ToGeoHash(20);
var geo01hash32 = geo01.ToGeoHash32(16);
var geo01hash64 = geo01.ToGeoHash64(32);
Assert.AreEqual("6314xp00e1ej140gw3hz", geo01hash.Value);
Assert.AreEqual(817991144U, geo01hash32.Value);
Assert.AreEqual(3513245211907368736UL, geo01hash64.Value);
var geo01rev = geo01hash.ToGeoCoordinate(3);
var geo01rev32 = geo01hash.ToGeoCoordinate(3);
var geo01rev64 = geo01hash.ToGeoCoordinate(3);
Assert.IsTrue(geo01.Equals(geo01rev));
Assert.IsTrue(geo01 == geo01rev);
Assert.AreEqual(geo01.Latitude.Value, geo01rev.Latitude.Value, 0.000001);
Assert.AreEqual(geo01.Longitude.Value, geo01rev.Longitude.Value, 0.000001);
Assert.IsTrue(geo01.Equals(geo01rev32));
Assert.IsTrue(geo01 == geo01rev32);
Assert.AreEqual(geo01.Latitude.Value, geo01rev32.Latitude.Value, 0.000001);
Assert.AreEqual(geo01.Longitude.Value, geo01rev32.Longitude.Value, 0.000001);
Assert.IsTrue(geo01.Equals(geo01rev64));
Assert.IsTrue(geo01 == geo01rev64);
Assert.AreEqual(geo01.Latitude.Value, geo01rev64.Latitude.Value, 0.000001);
Assert.AreEqual(geo01.Longitude.Value, geo01rev64.Longitude.Value, 0.000001);
}
示例3: ToGeoHashTest1
public void ToGeoHashTest1()
{
var geo01 = new GeoCoordinate(new Latitude(57.64911), new Longitude(10.40744));
var geo01hash = geo01.ToGeoHash(11);
var geo01hash32 = geo01.ToGeoHash32(16);
var geo01hash64 = geo01.ToGeoHash64(32);
Assert.AreEqual("u4pruydqqvj", geo01hash.Value);
Assert.AreEqual(3793206966U, geo01hash32.Value);
Assert.AreEqual(16291699867698975045UL, geo01hash64.Value);
var geo01rev = geo01hash.ToGeoCoordinate(5);
var geo01rev32 = geo01hash.ToGeoCoordinate(5);
var geo01rev64 = geo01hash.ToGeoCoordinate(5);
Assert.IsTrue(geo01.Equals(geo01rev));
Assert.IsTrue(geo01 == geo01rev);
Assert.AreEqual(geo01.Latitude.Value, geo01rev.Latitude.Value, 0.000001);
Assert.AreEqual(geo01.Longitude.Value, geo01rev.Longitude.Value, 0.000001);
Assert.IsTrue(geo01.Equals(geo01rev32));
Assert.IsTrue(geo01 == geo01rev32);
Assert.AreEqual(geo01.Latitude.Value, geo01rev32.Latitude.Value, 0.000001);
Assert.AreEqual(geo01.Longitude.Value, geo01rev32.Longitude.Value, 0.000001);
Assert.IsTrue(geo01.Equals(geo01rev64));
Assert.IsTrue(geo01 == geo01rev64);
Assert.AreEqual(geo01.Latitude.Value, geo01rev64.Latitude.Value, 0.000001);
Assert.AreEqual(geo01.Longitude.Value, geo01rev64.Longitude.Value, 0.000001);
}