Solved! Go to Solution.
IGeometry projectedShape = (originalShape as IClone).Clone() as IGeometry; ISpatialReferenceFactory3 srFactory = new SpatialReferenceEnvironmentClass(); IProjectedCoordinateSystem pcs = srFactory.CreateProjectedCoordinateSystem((int)esriSRProjCSType.esriSRProjCS_Sphere_Sinusoidal); pcs.SetFalseOriginAndUnits(0, 0, 1000000); projectedShape.Project(pcs); IGeometry5 buf = (projectedShape as ITopologicalOperator).Buffer(bufferMeters) as IGeometry5; buf.Project5(originalShape.SpatialReference, 0);
IBufferConstruction bufConstructor = new BufferConstructionClass(); (bufConstructor as IBufferConstructionProperties).Unit = new LinearUnitClass(); object unitName = "Meter"; object unitAlias = "Meter"; object unitAbbreviation = "M"; object unitRemarks = "Meter is the linear unit"; object unitMetersPerUnit = 1; ((bufConstructor as IBufferConstructionProperties).Unit as ILinearUnitEdit).Define(ref unitName, ref unitAlias, ref unitAbbreviation, ref unitRemarks, ref unitMetersPerUnit); IGeometry buf = bufConstructor.Buffer(m_input_segment_polyline.FromPoint, 1) // draw the buffer
You might try IBufferConstruction / IBufferConstructionProperties instead. It supports geodesic-based buffers on points at 10.0.
IBufferConstruction bufConstructor = new BufferConstructionClass(); (bufConstructor as IBufferConstructionProperties).Unit = new LinearUnitClass(); object unitName = "Meter"; object unitAlias = "Meter"; object unitAbbreviation = "M"; object unitRemarks = "Meter is the linear unit"; object unitMetersPerUnit = 1; ((bufConstructor as IBufferConstructionProperties).Unit as ILinearUnitEdit).Define(ref unitName, ref unitAlias, ref unitAbbreviation, ref unitRemarks, ref unitMetersPerUnit); IEnumGeometry input = new GeometryBagClass(); IGeometryCollection output = new GeometryBagClass(); (input as IGeometryCollection).AddGeometry(m_input_segment_polyline.FromPoint); IDoubleArray distances = new DoubleArrayClass(); distances.Add(1); bufConstructor.ConstructBuffers(input, 1, output); \\ bufConstructor.ConstructBuffersByDistances2(input, distances, output); \\alternative IElement ele = GeoUtils.AddGraphicToMap((m_application.Document as IMxDocument).FocusMap, output.Geometry[0], new RgbColorClass() { Red = 255, Green = 0, Blue = 0 }, new RgbColorClass { Red = 0, Green = 0, Blue = 255 }, 3);
The developer help states that the IBufferConstruction.Buffer method does not use the properties exposed in IBufferConstructionProperties. Try using one of the other buffer methods and see if that works.
You can specify the buffer distance in a distance unit different than that of the spatial reference of the input geometries. The unit must be of the same type (angular or linear) as that of the input geometries' spatial reference.
IGeometry projectedShape = (originalShape as IClone).Clone() as IGeometry; ISpatialReferenceFactory3 srFactory = new SpatialReferenceEnvironmentClass(); IProjectedCoordinateSystem pcs = srFactory.CreateProjectedCoordinateSystem((int)esriSRProjCSType.esriSRProjCS_Sphere_Sinusoidal); pcs.SetFalseOriginAndUnits(0, 0, 1000000); projectedShape.Project(pcs); IGeometry5 buf = (projectedShape as ITopologicalOperator).Buffer(bufferMeters) as IGeometry5; buf.Project5(originalShape.SpatialReference, 0);