Buffer distance not correct

2355
8
Jump to solution
01-27-2014 11:43 PM
DanikBourdeau2
New Contributor III
Hello,

I'm having difficulty creating an accurate buffer of a polygon.  I can request the buffered geometry and display the respective graphic just fine, but when I measure the distance of the buffer to the original polygon (using the esri measure dijit) the distance is not the same as my input distance.

When in ArcMap, I buffer the same polygon by the same distance and I get a different buffer than I get from the js Geometry Service so I'm fairly certain that my problem lies with the Geometry Service not the Measurement dijit.

var buffDist = dom.byId("BuffDist").value; var gph = graphicArray[0]; var gs = new GeometryService("http://tasks.arcgisonline.com/ArcGIS/rest/services/Geometry/GeometryServer"); var params = new BufferParameters(); params.distances = [buffDist]; params.unit = GeometryService.UNIT_KILOMETER; params.bufferSpatialReference = map.spatialReference; params.outSpatialReference = map.spatialReference; params.geometries = [gph.geometry]; gs.buffer(params, function (result) {});


My workflow is quite standard.  My input geometries are from a graphic that I received from a user click on the map.  The map spatial reference is web mercator (102100), which I thought might be causing the problem so I have been experimenting with converting web mercator to geographic but I have not had any luck getting a successful return from the Geometry Service.

Anyone have any ideas what is causing the buffer to be wrong?
0 Kudos
1 Solution

Accepted Solutions
JianHuang
Occasional Contributor III
The geometry service you are using on tasks.arcgisonline.com is version 10.04, which doesn't support geodesic parameter. Please try this:
http://sampleserver6.arcgisonline.com/arcgis/rest/services/Utilities/Geometry/GeometryServer/buffer
Please note, either services serve the purpose of just samples. It should not be part of your product code.

View solution in original post

0 Kudos
8 Replies
JianHuang
Occasional Contributor III
The geodesic parameter should be true when performing a buffer under web mercator.
https://developers.arcgis.com/javascript/jsapi/bufferparameters-amd.html#geodesic
0 Kudos
DanikBourdeau2
New Contributor III
Hi Jian,

I failed to mention that I had tried setting the geodesic parameter to true but it still does not give me a proper buffer.  I wasn't sure if Web Mercator should have the geodesic parameter set to true since it's listed as a projected coordinate system here?

I took some screen grabs to help illustrate what's going on.  The first image is from my web app where I'm buffering using the js api, same parameters as above except that I have now added geodesic=true.  The second image is from ArcMap where I have buffered the same polygon by the same amount, 100km.  I placed the same basemap under both images to show some context.

[ATTACH=CONFIG]30923[/ATTACH]

[ATTACH=CONFIG]30924[/ATTACH]
0 Kudos
JianHuang
Occasional Contributor III
Danik,

What does the json request look like?
0 Kudos
DanikBourdeau2
New Contributor III
This is the request i send out to the buffer service.  Is this what you are looking for?

[ATTACH=CONFIG]30925[/ATTACH]
0 Kudos
JianHuang
Occasional Contributor III
The geometry service you are using on tasks.arcgisonline.com is version 10.04, which doesn't support geodesic parameter. Please try this:
http://sampleserver6.arcgisonline.com/arcgis/rest/services/Utilities/Geometry/GeometryServer/buffer
Please note, either services serve the purpose of just samples. It should not be part of your product code.
0 Kudos
DanikBourdeau2
New Contributor III
Thanks Jian, that makes more sense now.

I'm a bit confused.  I thought we could use tasks.arcgisonline.com for production apps?  We have an organizational license for ArcGIS Online where we host all our feature services.  We tend to develop our own apps in house rather than use arc online's mapping interface.  Which Geometry Service should we be using?
0 Kudos
JianHuang
Occasional Contributor III
Danik,

Sorry for the confusion. I'm not the best person to answer the licensing question. You may want to contact Esri Support. But samplerserver6 definitely is just a 'sample'.
0 Kudos
DanikBourdeau2
New Contributor III
No worries.  I may post something in the arc online forums and see what I get.

I just changed the Geometry Server to sampleserver6 and everything worked like a charm.  Thanks very much for your help.
0 Kudos