Coordinate Quantization parameter specified is not correct

1402
0
01-31-2019 12:19 PM
JoelBennett
Occasional Contributor III

In case anybody else runs across this...

We have an application that will load one of many different FeatureLayers at any given time, and one of those layers was throwing an error that said "Coordinate Quantization parameter specified is not correct".

I ultimately traced this to the map service returning this in the metadata for the layer (i.e., part of what you see when you go to http://server/arcgis/rest/services/MyService/MapServer/0:(

"extent": {
    "xmin": "NaN",
    "ymin": "NaN",
    "xmax": "NaN",
    "ymax": "NaN",
    "spatialReference": {
       "wkid": 102100,
       "latestWkid": 3857
    }
 }

So there was a problem with the extent for the layer. I'm not sure why it was doing this, but this layer was a valid query layer with valid data, and the problem occured using ArcGIS Server 10.6.1 and JavaScript API 3.27. Whatever the case, there at least three possible solutions for this problem:

1) Somehow correct the problem causing the service to generate this info. This could possibly involve restarting and/or republishing the service. Depending on your organization (or if you're using data outside your organization), this might not be feasible or possible for you, especially if you need it working "now".

2) You could pass an undocumented property within the "options" argument of the FeatureLayer constructor with the name "quantize" and the value of false. For example:

var layer = new FeatureLayer(url, {id:"myLayer",visible:true,quantize:false});

As mentioned in my case, the problematic layer was one of many, and I didn't necessarily want to disable quantization for them all, so this wasn't optimal. However, depending on your restrictions, this may be the only option you have.

3) If you have a locally hosted copy of the API, you can "fix" your copy of it. The reasoning is that (1) since it is possible for ArcGIS Server to return an invalid extent, then (2) the JavaScript API should handle that gracefully, but in its current state, it doesn't.

By default, quantization is used (a) if it is enabled in the FeatureLayer object (see undocumented "quantize" parameter discussed in option 2 above, which defaults to true), and (b) if ArcGIS Server supports quantization for the layer in the map service. We can add an additional condition (c) that the extent object must also be valid, because quantization works only with a valid extent. This way, we won't waste network and server resources by sending requests we already know will fail.

To do this, I opened the init.js file, and did a find (Ctrl-f) for this text:

this.quantize&&this.supportsCoordinatesQuantization?("esriGeometryPolyline"

...and replaced it with this text:

this.quantize&&this.supportsCoordinatesQuantization&&!isNaN(this.fullExtent.getHeight())&&!isNaN(this.fullExtent.getWidth())?("esriGeometryPolyline"


I took the third option because it would've been a pain for me to troubleshoot the map service, and I didn't necessarily want to lose the benefits of quantization on "good" layers. And so now, the "problematic" layer works just fine.

0 Replies