public async Task <ActionResult> Search(string address) { var houseSummeries = await repairSearcher.Search(address); var extract = addressExtractor.Extract(houseSummeries.FirstOrDefault()?.Title ?? address); var geoCoordinate = await geocoder.Get(extract.City, extract.Street, extract.House); return(Json(geoCoordinate, JsonRequestBehavior.AllowGet)); }
private void ExtractAddress() { var elements = _searchCommand.GetElementsByText(Tag, Distance) .ToArray() .Wait(); if (elements == null || !elements.Any() || elements[0] == null) { return; } var coordinate = _searchCommand.SearchCenter; Array.Sort(elements, new ElementDistanceComparer(coordinate)); _subject.OnNext(AddressExtractor.Extract(elements[0].Tags)); }
public void CanExtractLocationInfo() { // ARRANGE var tags = new Dictionary <string, string>() { { "addr:housenumber", "26" }, { "addr:postcode", "220088" }, { "addr:street", "Zacharova" }, }.ToTags(); // ACT var locationInfo = AddressExtractor.Extract(tags); // ASSERT Assert.AreEqual("26", locationInfo.Name); Assert.AreEqual("Zacharova", locationInfo.Street); Assert.AreEqual("220088", locationInfo.Code); }