Buffering a Point and Map Units

4111
4
Jump to solution
07-22-2015 06:49 AM
JoshuaCorcoran
New Contributor II

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

0 Kudos
1 Solution

Accepted Solutions
TimWitt2
MVP Alum

I think the only way to do it without the service is if your map spatial reference is in meters?

View solution in original post

0 Kudos
4 Replies
TimWitt2
MVP Alum

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

JoshuaCorcoran
New Contributor II

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?

0 Kudos
TimWitt2
MVP Alum

I think the only way to do it without the service is if your map spatial reference is in meters?

0 Kudos
JoshuaCorcoran
New Contributor II

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.

0 Kudos