Method for generating a flat buffer in GIS

Source: Internet
Author: User
Method for generating a flat buffer in GIS

In arcengine, there are two buffer generation methods: itopologicaloperator. buffer (double distance) and geopressor. buffer.

The first method cannot select a parameter. By default, the circle Header Buffer is generated. The second method requires a buffer for the layer, which is extremely inconvenient for operations on a single element, and the line_end_type parameter is set to "flat ", it cannot be generated. There is almost no explanation on the Internet.

After patiently searching, I finally found a good method on the Internet and recorded it for backup. The principle of this method is to translate the line into the bufferdistance in the positive direction, then translate the bufferdistance in the negative direction, connect all the points of the two lines, and then convert them into polygon.

The source code is as follows:

/// <Summary>
/// Flat Buffer
/// </Summary>
/// <Param name = "myline"> line </param>
/// <Param name = "bufferdis"> buffer distance </param>
/// <Returns> </returns>
Private ipolympus Gon flatbuffer (ipolympus myline, double bufferdis)
{
Object o = system. type. missing;
// Translate the input line twice (in both the positive and negative directions)
Iconstructcurve mycurve = new polylineclass ();
Mycurve. constructoffset (myline, bufferdis, ref o, ref O );
Ipointcollection pcol = mycurve as ipointcollection;
Iconstructcurve mycurve2 = new polylineclass ();
Mycurve2.constructoffset (myline,-1 * bufferdis, ref o, ref O );
// Flip all nodes of the line for the second Translation
Ipolympus line addline = mycurve2 as ipolympus;
Addline. reverseorientation ();
// Put all the nodes of the second line in the ipointcollection of the first line
Ipointcollection pcol2 = addline as ipointcollection;
Pcol. addpointcollection (pcol2 );
// Use the surface to initialize an ipointcollection.
Ipointcollection mypcol = new polygonclass ();
Mypcol. addpointcollection (pcol );
// Convert ipointcollection to a surface
Ipolympus Gon mypolygon = mypcol as ipolympus gon;
// Simplify node order
Mypolygon. simplifypreservefromto ();
Return mypolygon;
}

 

From: http://www.dev-club.net/xiangxixinxi/1087042010072906074115/2010112408204313.html

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.