Hey Everyone. So I am developing an ArcGIS Add-On and I have some code here that buffers a point, successfully I might add. lol. What I don't understand is how I tell it to buffer a specific distance. The documentation states that it uses your map units. I am not sure what those are but basically what I am trying to do is, buffer a point by meters. Here is the code that I have but when I put buffer 10, it is way more than 10 meters. Thanks in advance.
protected override void OnMouseDown(MouseEventArgs arg)
{
var test = this.ScreenDisplayInstance.DisplayTransformation.ToMapPoint(arg.X, arg.Y);
test.SpatialReference = this.ActiveViewInstance.FocusMap.SpatialReference;
this.BufferPoint(test);
}
private void BufferPoint(IPoint point) { var topologicalOperator = (ESRI.ArcGIS.Geometry.ITopologicalOperator)point; var newGeo = topologicalOperator.Buffer(10);//Need this in meters }
V/R,
Josh
Solved! Go to Solution.
I think the only way to do it without the service is if your map spatial reference is in meters?
Joshua,
check out this example: Geodesic buffering | ArcGIS API for JavaScript
instead of kilometers use meters.
For more information check out "unit" here: https://developers.arcgis.com/javascript/jsapi/bufferparameters-amd.html#unit
Tim
So it looks like they are using the Geometry Service from ArcGIS server. Is there a way to do it without having to make outside the app?
I think the only way to do it without the service is if your map spatial reference is in meters?
Tim thanks for the lead that was exactly it. My map is in WGS84, so I ended up re projecting the point to a spatial reference that was in meters then performing the buffer and re-projecting back.