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.
Bobo,
If it is a FeatureLayer then construct it like this:
quantize:false
var layer = new FeatureLayer(url, {id:"myLayer",visible:true,quantize:false});
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.
Bobo,
It is an undocumented property.
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!
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
Do you have a simple codepen of jsbin showing the issue?