hitTest result sorting

556
3
Jump to solution
01-17-2023 07:16 AM
james-rae
New Contributor III

This is a follow-up of sorts to this post:

https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/clarification-on-4-23-hittest-ret...

It was hinted (not promised) that hitTest results would be sorted by draw order by v4.24. As of v4.25 the result array is still random. I can get around this if all layers have an orderBy applied to a field with unique values, but I don't always have that luxury. Otherwise, as far as I can tell, the ability to get the "top most" hit has been gone since v4.23.

I'm curious if the enhancement to sort the hitTest array is scheduled for a release yet. If it's still marinating in the backlog I feel I'm going to have to start exploring alternative approaches. I'd be all ears if there are ways to derive this by digging into the innards of various API objects; my prodding around hasn't been able to find anything.

Appreciate any responses, good day.

0 Kudos
2 Solutions

Accepted Solutions
UndralBatsukh
Esri Regular Contributor

Hi there, 

As you pointed out that the only workaround for the behavior you describe is here: https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/clarification-on-4-23-hittest-ret...

 

We do have plans to support sorting for hittest. But I don't have any dates when this will be implemented. 

-Undral

View solution in original post

0 Kudos
LaurenBoyd
Esri Contributor

@james-rae as mentioned in this post, the enhancement for the MapView.hitTest() method to respect the map drawing order has been implemented for version 4.29 (releasing soon). The returned features will adhere to the default drawing order of the data or a specific order if orderBy is specified on the layer.

Lauren

View solution in original post

0 Kudos
3 Replies
UndralBatsukh
Esri Regular Contributor

Hi there, 

As you pointed out that the only workaround for the behavior you describe is here: https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/clarification-on-4-23-hittest-ret...

 

We do have plans to support sorting for hittest. But I don't have any dates when this will be implemented. 

-Undral

0 Kudos
james-rae
New Contributor III

Appreciate the response and confirmation of the feature's priority.

0 Kudos
LaurenBoyd
Esri Contributor

@james-rae as mentioned in this post, the enhancement for the MapView.hitTest() method to respect the map drawing order has been implemented for version 4.29 (releasing soon). The returned features will adhere to the default drawing order of the data or a specific order if orderBy is specified on the layer.

Lauren
0 Kudos