Decode() public static method

public static Decode ( String geohash, SpatialContext ctx ) : System.Point
geohash String
ctx Spatial4n.Core.Context.SpatialContext
return System.Point
Ejemplo n.º 1
0
        public virtual void TestDecodeImpreciseLongitudeLatitude()
        {
            string hash = GeohashUtils.EncodeLatLon(84.6, 10.5);

            IPoint point = GeohashUtils.Decode(hash, ctx);

            CustomAssert.EqualWithDelta(84.6, point.Y, 0.00001D);
            CustomAssert.EqualWithDelta(10.5, point.X, 0.00001D);
        }
Ejemplo n.º 2
0
        public virtual void TestDecodePreciseLongitudeLatitude()
        {
            string hash = GeohashUtils.EncodeLatLon(52.3738007, 4.8909347);

            IPoint point = GeohashUtils.Decode(hash, ctx);

            CustomAssert.EqualWithDelta(52.3738007, point.Y, 0.00001D);
            CustomAssert.EqualWithDelta(4.8909347, point.X, 0.00001D);
        }
Ejemplo n.º 3
0
        public virtual void TestDecodeEncode()
        {
            string geoHash = "u173zq37x014";

            Assert.Equal(geoHash, GeohashUtils.EncodeLatLon(52.3738007, 4.8909347));
            IPoint point = GeohashUtils.Decode(geoHash, ctx);

            CustomAssert.EqualWithDelta(52.37380061d, point.Y, 0.000001d);
            CustomAssert.EqualWithDelta(4.8909343d, point.X, 0.000001d);

            Assert.Equal(geoHash, GeohashUtils.EncodeLatLon(point.Y, point.X));

            geoHash = "u173";
            point   = GeohashUtils.Decode("u173", ctx);
            geoHash = GeohashUtils.EncodeLatLon(point.Y, point.X);
            IPoint point2 = GeohashUtils.Decode(geoHash, ctx);

            CustomAssert.EqualWithDelta(point.Y, point2.Y, 0.000001d);
            CustomAssert.EqualWithDelta(point.X, point2.X, 0.000001d);
        }