I am trying to use the view.hitTest function for points, lines and polygons. The selected features look correct at the scale level when a feature was selected, but once I zoom there are visible geometric discrepancies. I had this issue with arcgis javascript 3.27 but someone on geonet suggested I set the autogeneralize as false for the feature layer and it worked. I am now coding with arcgis javascript 4.10 and the method for setting autogeneralize as false is not there (i am assuming it is the same issue) for feature layers. How can I solve this issue.
Do you have a simple codepen of jsbin showing the issue?
Bobo,
It is an undocumented property.
I tried the generalize method but it did not fix the problem I had. The parameters I gave were:
generalize = new GeneralizeParameters() generalize.geometries = [pointGraphicSelected.geometry] generalize.deviationUnit = "meters" generalize.maxDeviation = 0.000001
I tried putting the quantize option as false. It works really well with points, but with a polygon there is still a visible geometric error.
One other thing, I checked the properties of a feature layer for arcgis javascript 4.10 but quantize is not there. I just wanted to know what is the reason for that.
Hello Bobo,
Robert's solution works very well if you have a feature layer! I thought I should also mention this in case it could be of use to you: GeometryService | API Reference | ArcGIS API for JavaScript 4.10
There is a 'generalize' method that might get you what you are looking for.
I hope it helps!
If it is a FeatureLayer then construct it like this:
quantize:false
<SPAN class="" style="color: #0077aa; border: 0px; font-weight: inherit;">var</SPAN> layer <SPAN class="" style="color: #a67f59; background: rgba(255, 255, 255, 0.5); border: 0px; font-weight: inherit;">=</SPAN> <SPAN class="" style="color: #0077aa; border: 0px; font-weight: inherit;">new</SPAN> <SPAN class="" style="border: 0px; font-weight: inherit;">FeatureLayer</SPAN><SPAN class="" style="color: #999999; border: 0px; font-weight: inherit;">(</SPAN>url<SPAN class="" style="color: #999999; border: 0px; font-weight: inherit;">,</SPAN> <SPAN class="" style="color: #999999; border: 0px; font-weight: inherit;">{</SPAN>id<SPAN class="" style="color: #999999; border: 0px; font-weight: inherit;">:</SPAN><SPAN class="" style="color: #669900; border: 0px; font-weight: inherit;">"myLayer"</SPAN><SPAN class="" style="color: #999999; border: 0px; font-weight: inherit;">,</SPAN>visible<SPAN class="" style="color: #999999; border: 0px; font-weight: inherit;">:</SPAN><SPAN class="" style="color: #0077aa; border: 0px; font-weight: inherit;">true</SPAN><SPAN class="" style="color: #999999; border: 0px; font-weight: inherit;">,</SPAN>quantize<SPAN class="" style="color: #999999; border: 0px; font-weight: inherit;">:</SPAN><SPAN class="" style="color: #0077aa; border: 0px; font-weight: inherit;">false</SPAN><SPAN class="" style="color: #999999; border: 0px; font-weight: inherit;">}</SPAN><SPAN class="" style="color: #999999; border: 0px; font-weight: inherit;">)</SPAN><SPAN class="" style="color: #999999; border: 0px; font-weight: inherit;">;</SPAN>
Angemeldete Mitglieder können Beiträge verfassen, Updates folgen und mehr. Neu hier? Registriere ein kostenloses Konto.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.