Setting geometryPrecision in FeatureLayer

1452
5
08-27-2019 02:30 PM
Mohammad_AgusSalim
New Contributor II

Hello there,

I would like to add a feature layer to my map. When I do that, I noticed from the json that the coordinates returned by the server has unnecessary decimal precision. My feature service has Web Mercator projection (in meters) and when I used it as a FeatureLayer, it return coordinate up to 11 decimals like this: [13259971.983800001,572641.27050000057]. This makes the json response output size almost doubled and I think I can load my map faster by removing the unnecessary decimals.

I'm aware that through Query class, we can set geometryPrecision parameter to define decimals of coordinates that we want, but the part that I'm really lost is I dont know how to set this through FeatureLayer when its loaded for the first time to the map? I mean when I define a feature layer and would like to add it to the map like this:

var featureLayer = new FeatureLayer("https://services.arcgis.com/V6ZHFr6zdgNZuVG0/arcgis/rest/services/Landscape_Trees/FeatureServer/0");

map.addLayer(featureLayer);

I noticed that the map.addLayer() function will execute a query to server for the first time to load the FeatureLayer that I dont know how to include geometryPrecision parameter to that query. 

Thank you very much in advance and any help would be very appreciated.

Best,

Agus

5 Replies
mgeorge
Esri Contributor

Hi Mohammad Agus Salim‌. Is this in the context of trying to reduce network traffic by lowering payload sizes? FeatureLayers (in 4.X) will already make reduced precision quanitized queries when used against services that supported them. We've also since added a new more compressed pbf query format that further reduces payload sizes.

0 Kudos
Mohammad_AgusSalim
New Contributor II

Hi Matt, thank you very much for taking your time to respond. Yes, I was trying to reduce network traffic by lowering payload sizes. I unfortunately still using 3.29 for some reason. Is there any workaround that you think we can do?

0 Kudos
mgeorge
Esri Contributor

Sorry Mohammad, I don't have too much experience with 3X, but I'll check with someone and see if there is any workaround. I suspect however that there probably won't be one unfortunately.

0 Kudos
mgeorge
Esri Contributor

Mohammad Agus Salim‌ I talked two a couple of product engineers and and unfortunately I don't think we have a great workaround for this. For 4.x. though we will think about how we might allow more control over querying to allow apps to make their own trade-offs in terms of visual quality & network performance. 

0 Kudos
pxrich
by
New Contributor

Would love an update to this! I have hundreds of feature layers with hundreds of polygons, which only need integer precision as the map is restricted to low zooms.

Is there any ability yet to request lower-precision or quantized data, or to prevent low-precision coordinates from being converted to high-precision on upload?

0 Kudos