AnsweredAssumed Answered

Generate Address at an intersection. Mobile Map package and Address Locator

Question asked by mobiletecdevonline on Aug 14, 2018
We generate an address on the map by clicking on a street segment.
The locator returns the result (see imagen 1)

But when we click on an intersection (Crossing between two streets) we do not get the expected result, the crossing between the two streets (Street1 & Street2)
We need to get the same with the new version ArcGis Runtime 100.3
In version ArcGis Runtime  10.2.5 we obtained this result
(see Imagen 2)
I appreciate you can help us
This is the code and parameters that we send to the locator
public async Task<GeocodeResult> GenerateAddress()
        {
            try
            {
                var reverseGeoCodeParameters = new ReverseGeocodeParameters();
                var location = MapViewService.ScreenToLocation();
                if (Convert.ToBoolean(ListParameters.GetValue(ParameterId.MAP_USELOC, 1)))
                {
                    if (mobileMapPackage != null && mobileMapPackage.LocatorTask != null)
                    {                          
                        GraphicsOverlayAddress.Graphics.Clear();
                        GraphicsOverlayAddress.Graphics.Add(new Graphic(location, SymbolHelper.CreateSimpleMarkerSymbol()));
                        reverseGeoCodeParameters.MaxDistance = 10;
                        reverseGeoCodeParameters.OutputSpatialReference = EsriMap.SpatialReference;
                        reverseGeoCodeParameters.ResultAttributeNames.Add("*");
                        IReadOnlyList<GeocodeResult> addressInfolocal = await mobileMapPackage.LocatorTask.ReverseGeocodeAsync(location, reverseGeoCodeParameters);
                        if (addressInfolocal != null && addressInfolocal.Any())
                        {
                            var dataAddress = new Dictionary<string, string>();
                            foreach (var item in addressInfolocal.First().Attributes)
                            {
                                dataAddress[item.Key] = item.Value.ToString();
                            }
                            var normalizedPoint = GeometryEngine.NormalizeCentralMeridian(addressInfolocal.First().InputLocation);
                            var projectedCenter = GeometryEngine.Project(normalizedPoint, SpatialReferences.Wgs84) as MapPoint;
                            dataAddress["Coord"] = GetStringCoordenates(projectedCenter).Split((new List<char>() { ':' }).ToArray(),        StringSplitOptions.RemoveEmptyEntries)[1];
                            MapViewService.AddOverlay(location, dataAddress);
                            if (addressInfolocal != null && addressInfolocal.Any())
                                Clipboard.SetDataObject(addressInfolocal.First().Attributes["Street"]);
                            return addressInfolocal.First();
                        }
                        else
                            MapViewService.ClearOverlays();
                    }
                }
                else
                {
                    var _locator = new LocatorTask(new Uri("http://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer"));
                    var result = await _locator.ReverseGeocodeAsync(location, reverseGeoCodeParameters);
                    return result.FirstOrDefault();
                }
            }
            catch (Exception ex)
            {
                MapViewService.ShowMessage(LPMapEsriNet.ResourceManager.GetString("lbMessageErrorGenerateAddress", CultureInfo.CurrentCulture), "", MessageBoxButton.OK,   MessageBoxImage.Information);
                GraphicsOverlayAddress.Graphics.Clear();
                Logger.Logging(ex);
            }
            return null;
        }

Attachments

Outcomes