private long?ParseGeoHash(PostcodeResult?postcodeLookup) { if (postcodeLookup?.Latitude != null && postcodeLookup?.Longitude != null) { return(GeohashService.Encode(postcodeLookup.Latitude.Value, postcodeLookup.Longitude.Value)); } return(null); }
public void GetRanges() { double latitude = 51.146933; double longitude = -0.982808; GeohashService service = new GeohashService(); var range = service.GetRanges(latitude, longitude); Assert.Equal(2162357000000000, range[0].Min); Assert.Equal(2162357999999999, range[0].Max); Assert.Equal(2162359000000000, range[1].Min); Assert.Equal(2162359999999999, range[1].Max); }
public void Encode(double latitude, double longitude, long result) { GeohashService service = new GeohashService(); Assert.Equal(result, service.Encode(latitude, longitude)); }