wmbeers / cmv-app

CMV - The Configurable Map Viewer - A community supported open source mapping framework built with the Esri JavaScript API and the Dojo Toolkit
https://demo.cmv.io/
MIT License
1 stars 2 forks source link

Buffered features in AOI editor appear smaller than expected #26

Closed wmbeers closed 4 years ago

wmbeers commented 4 years ago

Lex reports that the actual size of buffered features is smaller than expected, based on the buffer distance/units input by users.

After confirming that the appropriate units are being sent to the buffer operation, and nothing unexpected is happening to the buffer distance, I looked at other parameters that are passed, and suspect it has something to do with the “geodesic” parameter passed to the geometry server buffer operation (https://developers.arcgis.com/rest/services-reference/buffer.htm)

When I added geodesic=true to the request, I get a buffered feature that looks to have the correct distance (sort of eyeballing with the measure tool). Currently I don’t set it, letting it default. (The default varies on the spatial reference and buffer unit, per the documentation linked above.)

What’s confusing is that seems to be the opposite of what their documentation says (see https://developers.arcgis.com/javascript/3/jsapi/bufferparameters-amd.html#geodesic and https://developers.arcgis.com/javascript/latest/api-reference/esri-tasks-support-BufferParameters.html#geodesic): “If the input geometries are in a geographic coordinate system, set geodesic to true to generate a buffer polygon using a geodesic distance.” The input/output spatial reference is Web Mercator, and the unit linear, and I previously wasn’t setting the parameter, so per this graphic (https://developers.arcgis.com/rest/services-reference/bufferpcs.htm) it’s defaulting to nongeodesic buffering. (Which jibes with the actual request URL that the JSAPI is generating, like: https://tasks.arcgisonline.com/ArcGIS/rest/services/Geometry/GeometryServer/buffer?f=json&unit=9001&unionResults=false&geodesic=false&geometries=%7B%22geometryType%22%3A%22esriGeometryPoint%22%2C%22geometries%22%3A%5B%7B%22x%22%3A-9356490.880719082%2C%22y%22%3A3549898.889026748%2C%22spatialReference%22%3A%7B%22wkid%22%3A102100%2C%22latestWkid%22%3A3857%7D%7D%5D%7D&inSR=102100&distances=1&outSR=102100

wmbeers commented 4 years ago

Published to dev for Lex to test.

wmbeers commented 4 years ago

Verified by Lex, pushed to production.