Why is hitTest returning duplicate attributes?

354
1
Jump to solution
03-10-2021 10:59 AM
MattStayner
Occasional Contributor

I am trying to get the attributes of a graphic using hitTest and I'm getting some unexpected results. See this example. In the console, the first attributes of the first graphic is displayed once the layer loads. There are lots of attributes, and none of them are duplicated, just as expected.

CLE: 2
CO_RVlu: 0.01
CO_Rmvd: 5.06
C_Seq: 95
C_Storage: 6771
Cmn_Name: "Siberian elm"
Cn_DieBack: 15
Cn_Missing: 10
Collected: 1349395200000
Condition: "Fair"
Crew: "Linden+ Forrest+ Johnny"
Crown_Base: 21
Crown_Height: 53
DBH1: 41
DBH2: 0
DBH3: 0
DBH4: 0
DBH5: 0
DBH6: " "
Dedication: " "
FID: 1
GroundArea: 2596
Height: 74
Ht_DBH_ft: 4.5
Isoprene_E: 2.7
LAI: 3.96
Land_Use: "I"
Latitude: 35.610441
Leaf_Area: 10295
Leaf_Bmass: 144
Live_Top: 74
Longitude: -82.441189
Monoterp_E: 13.2
NO2_Rmvd: 39.24
NO2_Rvlu: 0
Native: "NO"
Notes: " "
O3_Rmvd: 470.97
O3_Rvlu: 0.42
PM2p5_RVlu: 1.99
PM2p5_Rmvd: 47.84
PM10_Rmvd: 343.45
PM10_Rvlu: 3.73
SO2_Rmvd: 27.64
SO2_Rvlu: 0
S_Value: "3,079.00"
Sci_Name: "Ulmus pumila"
Spp_Code: "ULPU"
Status: "P"
Street: "YES"
Tree_Age: " "
Tree_ID: 102
Tree_Site: "S"
Vocs_E: 15.9
Width_EW: 40
Width_NS: 75

Then, when you click on a feature, it logs in the console the attributes of that graphic. 

C_Storage: 13227
FID: 1147
c_storage: 13227
fid: 1147

This leaves me with 2 questions:

1. Why aren't all of the attributes shown in the results from the hitTest?

2. Why are the attributes shown duplicated? They appear to be the same except attribute names in the second copy are all lowercase.

I see both issues are fixed when I add outFields: "*" to the featureLayer. I'm just wondering what the default functionality is about.

Tags (1)
0 Kudos
1 Solution

Accepted Solutions
ReneRubalcava
Frequent Contributor II

This will be fixed in 4.19 and you can test against our next build today. https://github.com/Esri/feedback-js-api-next

View solution in original post

1 Reply
ReneRubalcava
Frequent Contributor II

This will be fixed in 4.19 and you can test against our next build today. https://github.com/Esri/feedback-js-api-next