I have a polygon featureclass loaded into a Runtime SDK map from an mmpk. This featureclass contains polygons with holes cut out of them and filled by other polygons. An IdentifyLayersAsync with a point from GeoViewTapped at the location of an inner polygon will return in its results both the inner polygon and the surrounding donut polygon. Is this expected behavior for identify? If so is there a way to exclude the polygon with the hole from the identify results?
Hi,
Please can you post the section of code where you are running the identify? The polygon with the hole should not be returned in the results when performing an identify operation - what tolerance are you using?
Cheers
Mike
Hi Mike, the tolerance is currently set at 1. I've pared the code down to a minimum to reproduce the issue. I also tested with IdentifyLayerAsync, and get the same results.
private async void MyMapView_GeoViewTapped(object sender, GeoViewInputEventArgs e)
{
IReadOnlyList<IdentifyLayerResult> idrList = await MyMapView.IdentifyLayersAsync(e.Position, 1, false, 100);
foreach (IdentifyLayerResult idr in idrList)
{
if (idr.LayerContent == subzones)
{
MessageBox.Show("id layers: " + idr.GeoElements.Count.ToString()); //returns 2
}
}
IdentifyLayerResult result = await MyMapView.IdentifyLayerAsync(subzones, e.Position, 1, false, 100);
MessageBox.Show("id layer: " + result.GeoElements.Count.ToString()); //returns 2
}
For the time being, I have come up with a workaround to exclude the outer polygon that I can use if this issue can't be resolved.
Thanks for looking into this.
Dan
Dan,
Have you tried to decrease the "tolerance" value you provide to IdentifyLayersAsync(...).
From our Doc:
"Tolerance: radius in points specifying how precise the identify operation should be. A value of 0 means that it should be extremely precise - only those features appearing at the exact coordinates should be returned. A value of 22 (a good default for touch displays which covers an average finger tap) means features appearing within a 44pt buffer can also be returned. Max value permitted is 100. "
Thanks,
Tony
The tolerance is 1. Can it be less than 1? In any case I don't think it is a tolerance issue since if I click on one side of the inner polygon line I get both the inner and outer polygon and if I click on the other side I only get the outer polygon.
The spatial reference of the map view is wkid 3857.
Dan,
Would you be able to provide the two geometries in Json and the e.Position value you used so we can try to reproduce the behavior?
Thanks,
Tony
The following e.Position and 2 geometries are from clicking on the inner polygon within the donut hole.
e.Position:
541,312
geometry1:
{"rings":[[[559988.43503937125,948153.2470472455],[559980.01968504116,947270.72145669162],[559977.09547244012,946964.07874015719],[559988.8385826759,946904.49770341069],[559972.35465879366,946875.18274278194],[559973.1305774264,946854.89041994512],[559977.25853018463,946746.92257218063],[559977.25853018463,946220.80675853044],[559974.72670603544,946008.48261155188],[559975.03871390969,945514.87860892713],[559993.07545931637,945477.45866141468],[559973.47900262475,945424.18963254243],[559973.07545931637,944837.81561680138],[559973.9104330726,944785.31988188624],[559975.67650918663,944674.30479002744],[559969.08661417291,944312.96358267963],[559997.15551181138,944271.12270341069],[559780.39304462075,944273.421916008],[559432.22867454216,944277.11482939869],[559136.85859579965,944285.68077427894],[558473.80971128494,944287.28280840069],[557358.22670603544,944321.42257218063],[556131.74573490769,944336.90977690369],[555646.58070866019,944350.69061680138],[555566.89074803144,944352.95374015719],[555385.35761154816,944356.91666666418],[554760.68963254616,944370.55380577594],[554728.23064304516,944371.26279527694],[554734.74048556387,945077.91666666418],[554740.35859579965,945687.74967191368],[554745.07644356787,946994.86154855788],[554735.40124671906,949002.49967191368],[554733.63779527694,949368.39566928893],[554732.21948818862,949662.68766403943],[555045.15354330838,949654.50459317863],[555617.09744094312,949639.54888451099],[556034.55872703344,949628.63254593313],[556685.70374015719,949612.01476377994],[558695.51574803144,949560.89566928893],[559558.36843831837,949536.96062991768],[559991.02362204716,949527.81660105288],[559983.70964566991,949466.33464566618],[559988.80774278194,948232.12664041668],[560003.68471128494,948205.39074803144],[559988.7555774264,948186.85564304143],[559988.43503937125,948153.2470472455]],[[558020.3694225736,947656.8290682435],[557739.1194225736,947703.7040682435],[557713.07775590569,947500.5790682435],[557996.6259842515,947455.00885827094],[558020.3694225736,947656.8290682435]]],"spatialReference":{"wkid":2868}}
geometry2:
{"rings":[[[558020.3694225736,947656.8290682435],[557996.6259842515,947455.00885827094],[557713.07775590569,947500.5790682435],[557739.1194225736,947703.7040682435],[558020.3694225736,947656.8290682435]]],"spatialReference":{"wkid":2868}}
And the next geometry is from clicking on the outer polygon only.
e.Position:
551,119
geometry:
{"rings":[[[559988.43503937125,948153.2470472455],[559980.01968504116,947270.72145669162],[559977.09547244012,946964.07874015719],[559988.8385826759,946904.49770341069],[559972.35465879366,946875.18274278194],[559973.1305774264,946854.89041994512],[559977.25853018463,946746.92257218063],[559977.25853018463,946220.80675853044],[559974.72670603544,946008.48261155188],[559975.03871390969,945514.87860892713],[559993.07545931637,945477.45866141468],[559973.47900262475,945424.18963254243],[559973.07545931637,944837.81561680138],[559973.9104330726,944785.31988188624],[559975.67650918663,944674.30479002744],[559969.08661417291,944312.96358267963],[559997.15551181138,944271.12270341069],[559780.39304462075,944273.421916008],[559432.22867454216,944277.11482939869],[559136.85859579965,944285.68077427894],[558473.80971128494,944287.28280840069],[557358.22670603544,944321.42257218063],[556131.74573490769,944336.90977690369],[555646.58070866019,944350.69061680138],[555566.89074803144,944352.95374015719],[555385.35761154816,944356.91666666418],[554760.68963254616,944370.55380577594],[554728.23064304516,944371.26279527694],[554734.74048556387,945077.91666666418],[554740.35859579965,945687.74967191368],[554745.07644356787,946994.86154855788],[554735.40124671906,949002.49967191368],[554733.63779527694,949368.39566928893],[554732.21948818862,949662.68766403943],[555045.15354330838,949654.50459317863],[555617.09744094312,949639.54888451099],[556034.55872703344,949628.63254593313],[556685.70374015719,949612.01476377994],[558695.51574803144,949560.89566928893],[559558.36843831837,949536.96062991768],[559991.02362204716,949527.81660105288],[559983.70964566991,949466.33464566618],[559988.80774278194,948232.12664041668],[560003.68471128494,948205.39074803144],[559988.7555774264,948186.85564304143],[559988.43503937125,948153.2470472455]],[[558020.3694225736,947656.8290682435],[557739.1194225736,947703.7040682435],[557713.07775590569,947500.5790682435],[557996.6259842515,947455.00885827094],[558020.3694225736,947656.8290682435]]],"spatialReference":{"wkid":2868}}
Dan,
what results do you get when you try:
MapPoint pt = new MapPoint(-12510471.4877441, 3975740.5774242762, new SpatialReference(3857));
var results = await MyMapView.IdentifyLayersAsync(MyMapView.LocationToScreen(pt), 1, false);
What version of the ArcGIS Runtime .Net API are you using?
Thanks,
Tony