BufferConstruction を使用したバッファー作成

投稿日:2016/9/1 (木) 更新日:

Type t = Type.GetTypeFromProgID ("esriGeometry.SpatialReferenceEnvironment");
ISpatialReferenceFactory pSpatialReferenceFactory = (ISpatialReferenceFactory)Activator.CreateInstance(t);
 
ISpatialReference wgs84 = pSpatialReferenceFactory.CreateGeographicCoordinateSystem(4326);  //WGS84
IUnit meter = pSpatialReferenceFactory.CreateUnit(9001);   //esriSRUnitType.esriSRUnit_Meter
 
//入力ポイント
IPoint inPoint = new PointClass();
inPoint.SpatialReference = wgs84;
inPoint.X = 135;
inPoint.Y = 35;
 
//GeometryBag に格納
IEnumGeometry inGeometries = new GeometryBagClass();
IGeometryCollection inGeometriesGC = (IGeometryCollection)inGeometries;
IGeometry inGeometriesG = (IGeometry)inGeometries;
inGeometriesG.SpatialReference = wgs84;
inGeometriesGC.AddGeometry(inPoint);
 
IGeometryCollection outGeometries = new GeometryBagClass();
 
//BufferConstruction
IBufferConstruction pBufferConstruction = new BufferConstructionClass();
IBufferConstructionProperties2 pBufferConstructionProperties2 = (IBufferConstructionProperties2)pBufferConstruction;
pBufferConstructionProperties2.UseGeodesicBuffering = true; //測地線距離
pBufferConstructionProperties2.Unit = meter;    //単位指定
 
IGeometry buffer = pBufferConstruction.Buffer((IGeometry)inPoint, 1000); //BufferメソッドはpBufferConstructionPropertiesの指定は効かない
pBufferConstruction.ConstructBuffers(inGeometries, 10000, outGeometries);
 
IArea pArea = (IArea)outGeometries.get_Geometry(0); //座標系は元のじおめとりと同じ
 
 
Console.WriteLine(outGeometries.get_Geometry(0).SpatialReference.Name);
Console.ReadKey();<small>小さなテキスト</small>

関連記事

-プログラミング, ArcGIS
-, ,

Copyright© WINGFIELD since1981 , 2018 All Rights Reserved.