Select to view content in your preferred language

Polyline buffer with linear distance unit

1314
3
Jump to solution
01-19-2012 12:13 PM
JasonKnisley
Deactivated User
I'm designing an app that allows users to perform spatial queries in a variety of ways.  One requirement that is giving me problems is polyline buffering.  For example, a user should be able to draw a polyline and then select a buffer distance in one of the following units: feet, meters, kilometers, and miles.  My map SR is 102100.  I noticed that for both point and polyline buffers the results were about 18% short.  For some reason the following code returns a buffer with a radius of approximately 8.2 statue miles instead of 10.
BufferParameters bufferParameters = new BufferParameters() {     BufferSpatialReference = myMap.SpatialReference,     OutSpatialReference = myMap.SpatialReference,     Unit = LinearUnit.StatuteMile }; bufferParameters.Distances.Add(10); bufferParameters.Features.Add(new Graphic() { Geometry = originPoint });


For point buffers I was able to fix this by setting
BufferSpatialReference = new SpatialReference(4326)
but for polylines I have no such luck because of the notes here which state
when the bufferSR is GCS... Polylines and Polygons: unit must be angular such as decimal degrees for buffering to be performed.


How can I go about getting an accurate buffer around a polyline in a unit such as statute miles?
0 Kudos
1 Solution

Accepted Solutions
DominiqueBroux
Esri Frequent Contributor
Geodesic buffering needs GCS spatial reference. So if your BufferSpatialReference is 102100, a result 18% short is due to Mercator distorsion. That's normal so far.

Now if you set the BufferSpatialreference to 4326, you are right, that seems not working with polylines (though strange that it's returning a completely wrong result instead of an error! Not sure if it's a bug:confused: ).

If you are working with relatively small geometries (compared to the earth), a workaround might be to keep 102100 as BufferSpatialReference and to take care of the web mercator distorsion by yourself.
Soemthing like:
const double earthRadius = 6378137; double yCenter = graphic.Geometry.Extent.GetCenter().Y; double distorsion = Math.Cosh(yCenter / earthRadius); // mercator distorsion (= 1/cos(latitude))  bufferParams.Distances.Add(distance * distorsion);

View solution in original post

0 Kudos
3 Replies
DominiqueBroux
Esri Frequent Contributor
Geodesic buffering needs GCS spatial reference. So if your BufferSpatialReference is 102100, a result 18% short is due to Mercator distorsion. That's normal so far.

Now if you set the BufferSpatialreference to 4326, you are right, that seems not working with polylines (though strange that it's returning a completely wrong result instead of an error! Not sure if it's a bug:confused: ).

If you are working with relatively small geometries (compared to the earth), a workaround might be to keep 102100 as BufferSpatialReference and to take care of the web mercator distorsion by yourself.
Soemthing like:
const double earthRadius = 6378137; double yCenter = graphic.Geometry.Extent.GetCenter().Y; double distorsion = Math.Cosh(yCenter / earthRadius); // mercator distorsion (= 1/cos(latitude))  bufferParams.Distances.Add(distance * distorsion);
0 Kudos
JasonKnisley
Deactivated User
Dominique,
Thanks!  I had a feeling there was some sort of distortion at work since my results were always off by a consistent margin, but I didn't want to make a wrong assumption and I wasn't sure of the best way to work around it.  The distances I'm concerned with are small and the formula you posted will work for me.  Thanks again!
0 Kudos
williambich
Emerging Contributor
Is there a newer fix for this.  I am trying to buffer a polyline in silverlight arcgis api.  My buffers if using (bufferspacial reference of 4326 and geodesic=true) are comming back out of bounds.  Map Points are exactly spot on, but I have a requirement for buffering polylines and polygons on a map with a SR of 102100 (Web Mercator)
0 Kudos