Map seach error

467
2
09-13-2017 06:37 PM
YuriGvozdev
New Contributor II
Search by map (vector * .mmpk) returns the number of objects specified in the settings, but returns the same object. For example, when searching for "Street Sadovaya" returns several objects with the same coordinates. How to make it look for different objects
0 Kudos
2 Replies
dotMorten_esri
Esri Notable Contributor

Could you be a little more specific? How are you doing the search? Do you have a small sample that reproduces the problem you're seeing?

0 Kudos
YuriGvozdev
New Contributor II

public delegate void dlgFind(int sfF);
public event dlgFind onFind;

public async void FindObj(string fnTxt)
{
_i = 0;
_findOverley.Graphics.Clear();
var gm = (Esri.ArcGISRuntime.Geometry.Geometry)MyMapView.VisibleArea;

var mapCenter = MyMapView.GetCurrentViewpoint(ViewpointType.CenterAndScale).TargetGeometry as MapPoint;
var geocodeParams = new GeocodeParameters
{
MaxResults = 10,
PreferredSearchLocation = mapCenter,
CountryCode = "RUS",
OutputLanguage = new System.Globalization.CultureInfo("ru-RU"),
OutputSpatialReference = SpatialReferences.Wgs84
};
results = await locator.GeocodeAsync(fnTxt, geocodeParams);
if (results.Count == 0)
{
MessageBox.Show("По вашему запросу ничего не найдено!", "Ничего не найдено", MessageBoxButton.OK, MessageBoxImage.Information);
return;
}
onFind?.Invoke(1);

string pathStr = @"pack://application:,,,/ctlGeoViev;component/Images/places16.png";
Uri cUri = new Uri(pathStr);
PictureMarkerSymbol _ps = new PictureMarkerSymbol(cUri);
_ps.OffsetY = 12;

var seekY = results[0].InputLocation.Y;
var seekX = results[0].InputLocation.X;

Graphic gr = new Graphic(mp, _ps);
_findOverley.Graphics.Add(gr);
}

public async void FindObjNext()
{
_i++;
if (_i < results.Count)
{
_findOverley.Graphics.Clear();
string pathStr = @"pack://application:,,,/ctlGeoViev;component/Images/places16.png";
Uri cUri = new Uri(pathStr);
PictureMarkerSymbol _ps = new PictureMarkerSymbol(cUri);
_ps.OffsetY = 12;

var seekY = results[_i].InputLocation.Y;
var seekX = results[_i].InputLocation.X;

Graphic gr = new Graphic(mp, _ps);
_findOverley.Graphics.Add(gr);
}
else
{
_findOverley.Graphics.Clear();
onFind?.Invoke(0);
MessageBox.Show("Поиск завершен!", "", MessageBoxButton.OK, MessageBoxImage.Information);
}
}

0 Kudos