I am attempting to create a buffer around a feature(lineshape) from the Map_Click event. I have my feature and distance, but clearly do not get the buffer part. I do not get any warnings or errors telling me this will not work. I took what I thought would work from forum posts and WIKI Multi Ring Buffering, again, clearly, I am not getting it.
For Each myFeature As Feature In closestline PIRdist = Convert.ToInt32(myFeature.ColumnValues("PIR")) Dim lshape As BaseShape = myFeature.GetShape() lshape.Buffer(PIRdist, GeographyUnit.DecimalDegree, DistanceUnit.Feet) foundlines.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyles.CreateSimpleAreaStyle(GeoColor.FromArgb(150, 50, 250, 250)) foundlines.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20 foundlines.EditTools.Add(New Feature(lshape)) foundlines.EditTools.CommitTransaction() foundlines.Close() Next myFeature
For Each myFeature As Feature In closestline PIRdist = Convert.ToDouble(myFeature.ColumnValues("PIR")) Dim lshape As AreaBaseShape = myFeature.GetShape().Buffer(PIRdist, 30, BufferCapType.Round, GeographyUnit.DecimalDegree, DistanceUnit.Feet) foundlines.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyles.CreateSimpleAreaStyle(GeoColor.FromArgb(250, 50, 250, 250)) foundlines.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20 foundlines.EditTools.Add(New Feature(lshape)) foundlines.EditTools.CommitTransaction() foundlines.Close() Next myFeature
I am getting some rather erratic results creating a buffer at a certain distance in feet. Or maybe my measure tool I use to check the accuracy of the buffer distance is not measuring properly. I am seeing 10 to 50 foot difference between the two.
To measure I use currentCoords.GetDistanceTo(LastPoint, GeographyUnit.DecimalDegree, DistanceUnit.Feet)
I do not think my AreaBaseShape is as reliable or precise as my measure utility. Any thoughts?
The buffer result should based on really earth, so I think if you want to get a standard result, you should want to put it in some special projection or calculate that near the equator.
If possible please let me know your more detail requirement here.
I did a test today, it looks the distance is nearly the same.
LineShape line = new LineShape(); line.Vertices.Add(new Vertex(100, 30)); line.Vertices.Add(new Vertex(101, 30)); Feature lineFeature = new Feature(line); MultipolygonShape bufferShape = lineFeature.GetShape().Buffer(150, 30, BufferCapType.Round, GeographyUnit.DecimalDegree, DistanceUnit.Feet);
PointShape point = new PointShape(101.00045860032223, 30.000122881585991); // I get this value from bufferShape double distance = point.GetDistanceTo(new PointShape(101, 30), GeographyUnit.DecimalDegree, DistanceUnit.Feet); // result is 151.66533745100807
If you found they are not the same, could you please double check whether your test data lost accuracy?