Synopsis on life safety: "How to avoid getting into an extreme situation" (grade 6). Polygon to Line (Data Management)

Now consider the problem of calculating the area of ​​intersection of two convex polygons P and Q . Except where otherwise noted, we will assume that two polygons intersect non-degenerately: the intersection of two edges occurs at a single point that is not a vertex of any polygon. Given this assumption about non-degeneracy, we always get that the polygon consists of alternating chains of R and Q . Each pair of consecutive chains is connected at an intersection point where the boundaries intersect. polygons P and Q (Fig. 6.11).

There are several solutions to this problem with a linear dependence of the execution time on the total number of vertices. The algorithm described here is particularly elegant and easy to apply. For two convex polygons given at the input P and Q the algorithm determines the window on the edge of the polygon P another window on the edge of the polygon Q . The idea is

Rice. 6.11. The structure of the intersection polygon.

in advancing these windows along the boundaries of the polygon but as the intersection polygon is formed: the windows seem to push each other along the border of their respective polygons in a clockwise direction to find the intersection points of the edges. Since the intersection points are detected in the order in which they are located around the polygon, the intersection polygon is formed when some intersection point is detected a second time. Otherwise, if no intersection points are found after a sufficient number of iterations, then the polygon boundaries do not intersect. In this case, an additional simple test is required to see if one polygon is contained within another or if they do not intersect at all.

To explain the work, it turns out to be very useful to introduce the concept of a sickle. On fig. 6.12 the six shaded polygons will be crescents. Each of them is limited by a chain taken from the polygon P , and a chain from the polygon Q bounded by two successive intersection points. The inner chain of the crescent will be the part that belongs to the intersection polygon. Note that the intersection polygon is surrounded by an even number of crescents, the inner chains of which are alternately part of the boundaries of the polygons P and Q .

Rice. 6.12. Sickles surrounding the intersection polygon.

In terms of crescents, the intersection polygon search algorithm goes through two phases. During the first phase, the window p polygon P and window q polygon Q are moved in a clockwise direction until they are installed on edges that simultaneously belong to the same sickle. Each window starts its movement from an arbitrary position. Here, for brevity, we will use the same symbol p to designate as a polygon window P , and edges in this window. Then the term "beginning p " will refer to the start point of the edge in the polygon window P , and the command "promote p " will mean that you need to move the polygon window P to the next edge. Similarly, the letter q will be denoted as the polygon window Q , and the edge in the window. Sometimes the ribs p and q we will consider as current edges.

During phase 2 p and q continue to move in a clockwise direction, but this time they move in unison from one sickle to an adjacent sickle. Before any window transitions from the current sickle to the adjacent one, the edges p and q intersect at the intersection point connecting both crescents. The intersection polygon is built during the second phase. Before every move p edge endpoint p is entered into the intersection polygon if the edge p belongs to the internal chain of the current sickle. Similarly, before moving q the end point of the edge is fixed q , if q belongs to the internal chain of the current sickle. At each intersection of edges p and q the intersection point where they intersect is recorded in the intersection polygon.

To decide which window should move, the algorithm uses a move rule. This rule is based on the following remarks: we say that the edge a aimed at the rib b if the infinite straight line defined by the edge b , located in front of a (Fig. 6.13).

Rice. 6.13. Only the edges shown in thick lines are directed to the edge q, the rest are not.

Edge a aimed at b if one of the following conditions is met:

Note that the relation corresponds to the case in which the angle between the vectors a and b less 180 degrees.

Function aimsAt returns a value TRUE , if and only if the edge a aimed at the rib b . Parameter class indicates the position of the end point a.dest relative to the edge b .

Parameter crossType takes on the value COLLINEAR , if and only if the edges a and b collinear.

bool aimsAt (Edge & a, Edge&b, int aclass , int crossType )
(Point2 va = a.dest a.org;
Point2 vb = b.dest b.org;
if (crossType != COLLINEAR)
(if((va.x * vb.y ) >= (vb.x * va.y ))
return (aclass !=
right);
else
return(aclass != LEFT);
}
else
(return (aclass != BEYOND);
}
}

If the ribs a and b are collinear, then the edge a aimed at b if end point a.dest does not lie after b . This circumstance is used to promote a instead of b when two edges intersect degenerately at more than one point. Allowing a "catching up" b , we ensure that no intersection point is missed.

Let's return to the discussion of the rules of movement. They are worded in such a way as not to miss the next intersection point. The rules distinguish between the current edge, which may contain the next intersection point, and the current edge, which may possibly not contain the next intersection point, in which case the window is moved quite safely. The movement rules distinguish between four situations, shown in Fig. 6.14. Here is a rib a considered to be off edge b if end point a.dest located to the left of b .

Rice. 6.14. Four rules for moving: (a) - advance p ; (b) - advance p ; (c) - advance p , (d) - advance p.

1. p and q are aimed at each other: moves the window corresponding to that edge ( p or q ) that is outside the other. In the situation of Fig. 6.14 a the window on the edge must be moved R . The next intersection point cannot lie on p , since the edge p is outside the intersection polygon.

2. p aimed at q , but q not aimed at p p p not outside q and then window p transferred. On fig. 6.14b rib p cannot contain the next intersection point (although it may contain some intersection point if p is not outside of q ). On fig. shows the situation in which the edge p , whose window is to be moved, is not outside the edge q .

3. q aimed at p , but p not aimed at q : end end point of the edge q is entered into the intersection polygon if q not outside of p , after which the window is moved q (Fig. 6.14c). This case is symmetrical to the previous one. On fig. shows the situation in which the edge q , whose window is to be moved, is outside the edge p .

4. p and q not aimed at each other: the window that belongs to the edge located outside of the other is transferred. According to fig. 6.14 you need to move the window p , since the edge p is outside the rib q .

The operation of the algorithm is shown in fig. 6.15. Each edge is labeled i , if it is processed in the step i (at some edges are double labeled because they are processed twice). The two initial edges have

Rice. 6.15. Finding an intersection polygon. The edge has a label i , if it is processed at step i . The two initial edges are labeled 0.

label 0 . In this figure, phase 2 (when two current edges happen to belong to the same sickle) starts after three iterations. The algorithm is implemented in the program convexPolygonIntersect . Polygons are transferred to the program P and Q , it returns a pointer to the resulting intersection polygon R . Function call advance used to move one of the two current edges and to include the end endpoint of the edge in the polygon R subject to the fulfillment of certain conditions. Uses windows that exist inside the class Polygon .

enum (UNKNOWN, P_IS_INSIDE, Q_IS_INSIDE) ;
Polygon *convexPolygonIntersect (Polygon &P, Polygon &Q)
(Polygon*R;
Point iPnt , startPnt ;
int inflag = UNKNOWN;
int phase = 1;
int maxItns = 2 * (P.size O + Q.size O);
// start of the for loop
for (int i = 1; (i<=maxItns ) || (phase==2); i++ )
(Edge p = P.edge();
Edgeq = Q.edge();
int pclass = p.dest.classify(q);
int qclass = q.dest.classify(p);
int crossType = crossingPoint (p , q , iPnt );
if (crossType == SKEW_CROSS)
( if (phase == 1)
(phase = 2;
R = new Polygon ;
R->insert(ipnt );
startPnt = iPnt ;
}
else
if (ipnt !=
R->point())
(if (iPnt != startPnt )
R->insert(ipnt );
else
return R;
}
if (pclass==RIGHT)
inflag = P_IS_INSIDE;
else
if(qclass==RIGHT)
inflag = Q_IS_INSIDE;
else inflag = UNKNOWN;
}
else
if((crossType ==COLLINEAR) &&
(pclass != BEHIND) && (qclass != BEHIND))
inflag = UNKNOWN;
bool pAIMSq = aimsAt(p, q, pclass , crossType );
bool qAIMSp = aimsAt(q, p, qclass , crossType );
if (pAIMSq && qAIMSp )
(if ((inf lag == Q_IS__INSIDE)||
((inflag == UNKNOWN)&&(pclass ==LEFT)))
advance(P, *R, FALSE);
else
advance(Q, *R, FALSE);
}
else
if(pAIMSq )
(advance(P, *R, inflag == P_IS_INSIDE);
}
else
if (qAIMSp )
(advance(Q, *R, inflag == Q_IS_INSIDE);
}
else
(if ((inflag == Q_IS_INSIDE)
((inflag == UNKNOWN) && (pclass == LEFT)))
advance(P, *R, FALSE);
else
advance(Q, *R, FALSE);
}
}
//
the end
cyclefor
if (pointInConvexPolygon(P.point(), Q))
return new Polygon(P);
else
if (pointlnConvexPolygon(Q.point(), P))
return new Polygon(Q);
return new Polygon;
}

If no intersection points are found after the iterations, then the main loop ends, since this means that the polygon boundaries do not intersect. Subsequent calls to the function pointInConvexPolygon produced in order to detect situations , or =0. Otherwise, if some intersection point is found IPnt , then the algorithm continues building the intersection polygon R and stops only after the point IPnt will be found again.

Variable inflag indicates which of the two input polygons is currently inside the other - i.e. points to the polygon whose current edge is in the internal chain of the current sickle. Moreover, the variable inflag takes on the value UNKNOWN (unknown) during the first phase, and whenever both current edges are collinear or overlap each other. The value of this variable changes each time a new intersection point is found.

Procedure advance advances the current polygon edge A representing either P , or Q . The same procedure populates the endpoint of the edge x to the intersection polygon R , if A is inside another polygon and x was not the last point recorded in R :

void advance(Polygon2 &A, Polygon2 &R, int inside)
(A.advance(CLOCKWISE);
if(inside && (R.point() != A.point()))
R.insert(A.point());
}

Analysis and correctness.

The proof of correctness shows the most important points of the algorithm - the same set of promotion rules works during both phases. Advance rule enters p and q into the same sickle and then moves p and q in unison from one sickle to another.

The correctness of the algorithm follows from two statements:

Statement 2 ensures that the algorithm will find some intersection point, if one exists. Because the ribs p and q belong to the same crescent, if they intersect, then Proposition 1 implies that the other intersection points will be found in the required order.

Let us first consider Statement 1. Suppose that p and q belong to the same sickle and q reaches some point of intersection before R . We will show that then q stays still until p will not reach the intersection point after a series of successive advances. Two situations may arise. Let's first assume that p is outside of q (Fig. 6.16a). Wherein q will remain fixed until p will advance according to zero or more applications of rule 4, then zero or more applications of rule 1, and then zero or more applications of rule 2. In the second situation, suppose that p not outside of q (Fig. 6.16b). Here q will remain fixed until p will advance by zero or more applications of rule 2. In a symmetrical situation, when p reaches the intersection before q , edge q remains fixed, and the edge q advances to the meeting point. This can be shown in a similar way, only the role changes p and q and rule 3 replaces rule 2. Statement 1 follows from this.

To show Proposition 2, suppose that the bounds P and Q intersect. After iterations, either p , or q must make a complete revolution around their polygon. Let's assume this happened to R . At some point in time, the edge p must be positioned so that it contains the intersection point at which the polygon Q passes from outside the polygon P inside it. This is because there are at least two intersection points and the direction of the intersection is reversed. Let q will be an edge inside the polygon window Q at the time of the discovery R .

On fig. 6.17 polygon boundary Q split into two chains and . The first chain ends at the edge , at that edge of the polygon Q , which is inside the polygon P through his rib p . Another chain ends

Rice. 6.16. Advance to the next intersection point.

at an edge whose endpoint lies to the right of the infinite straight line defined by the edge p , and it is farthest from this straight line. Two cases should be considered, depending on which of the two chains the edge belongs to q :

Case 1. Here p remains fixed while q advances according to zero or more applications of rule 3, then rule 4, then rule 1, and finally rule 3 when an intersection point is found.

Case 2. Here q remains fixed and p advances according to zero or more applications of rule 2, then rule 4, then rule 1, and finally rule 2 at the moment when p will be inside q . From now on, both ribs p and q can advance several times, but the edge q cannot be advanced past its next intersection point until p first does not reach the previous intersection point of the edge q (if this has not already happened to the edge p ). Because the p and q end in the same crescent, statement 1 guarantees that after some number of additional advances they will intersect at the intersection point where the current crescent ends.

To show that iterations are enough to find some intersection point, we note that when proving Statement 2 (that the boundary of the polygon Q is inside the polygon P over the edge p at an arbitrary position of the edge q ) starting positions p and q were achieved when no more than iterations were performed. In fact, such a situation, or symmetrical to it, in which the roles p and q interchangeable, is achieved in a smaller number of iterations. Because after that p , nor q will not be advanced a full turn before the first intersection point is reached, no more extra promotions.

Rice. 6.17. An illustration of the proof that one can find an intersection point if the boundaries P and Q intersect.

During the drawing of polygons, a situation may arise when we have objects inside the polygons, and there is a new polygon that has a border with another polygon. Look at the figure below, the new outline of the polygon is just highlighted in black.

In order to draw polygons that have a border or within which there are other polygons, there is a special tool.

We need to use it almost like in the first picture to outline the outline and double-click to complete.

As you can see, a new polygon has appeared, and all borders are automatically added. After all, we did not draw all the borders. Although this procedure is very similar to topological coverage, it is not. Read "Step 3 - Concept of topology". The border for two objects must be one, but we can use the pointer tool

Take and move any area.

You can return back with the command Undo.

Step 28 - Cutting Out the Square

Usually the map is bounded by a border, and the polygon borders must fit exactly with the map border. If we act as in last step, then our boundary will not be even. You can do it differently. Delete our theme BASEA.

And we will recreate. In the same folder. The only thing for this to work is to close the project after deleting the theme, saving the changes and reopening it.

Let's use the rectangle tool.

And draw a frame that covers the entire drawing.

In the polygon drawing tools, we have one that can help us.

Let's select it and try to cut a piece.

We will have a new landfill. Just click to the side with the pointer to deselect, and then click back.

Step 29 - Areal Theme Transparency

Draw like in last step is to draw at random. But the area theme has a legend, so we can customize the display. Go to the legend, double click on the symbol.

We have four concepts in the areal legend. The first concept is filling.

I chose dotted so that you can see the picture below through the dots. Next, the color of the icons in the fill - Foreground.

Here I set that there is no background. And the last concept is the color of the border outline.

Everything can be clicked OK and the theme below will shine through your theme.

Step 30 - Copying the Theme

Having dealt with the frame in the last step, the question immediately arises. After all, we can have many themes that contain areas and must contain the same frame. The easiest way out is to use the ability to copy the topic to ArcView. After the topic is created, you can use the menu item Convert.

After selecting this menu item, you will again be asked for the name of the new topic.

Specify it and you will have exactly the same theme in a project with a different name.

Step 31 - Line Theme

It is added in the same way as other topics, only the type must be selected LINE.

Lesson 6. How to avoid getting into an extreme situation.

Educational questions.

1. Preparation for the hike.

2. Rules for safe behavior in nature.

Target. At the end of the study of the topic, students should have an idea of ​​the basic rules of behavior in natural conditions.

The main content of the lesson

How to avoid getting into extreme situations in natural conditions? It is advisable to consider this issue on the example of a tourist trip of schoolchildren (class).

Preparing for a hike is an important step in ensuring safety. Preparatory activities: determining the goals and objectives of the trip, developing a route, purchasing food, public (tents, cooking utensils) and personal equipment.

Invite the students to solve the word encrypted in the rebus (section 1, chapter 3, task 7).

Submission of the route of the trip to the route qualification commission, registration of the group and route in the search and rescue service (PSS). Purpose of registration.

Compliance with the rules of safe behavior on the route, at a halt, when overcoming obstacles is the main stage in ensuring safety.

Rules for the movement of the group on the route. Safety rules when driving on difficult terrain. Basic rules for a safe attitude to nature on the route and at a halt.

Have the students solve the riddle:

Who, as soon as it gets hot, Pulls a fur coat over his shoulders, And the evil cold comes on, Throws her off her shoulders? (Forest)

A rule for those who go on reconnaissance. The concept of "polygon boundaries" and linear landmarks (roads, clearings, forest border, power lines). Why are they defined?

Conclusion. Review the main points and check how the topic is understood.

Questions to test the acquired knowledge.

Explain what is the main purpose of careful preparation for the campaign? Why does the leader of the group have absolute power during the campaign? Why does the leader of the group report the route of the hike and the timing of it to the local PSS? Tell us about the rules for the movement of the group on the route. Why are the last kilometers of a day's march considered difficult? How should one treat the environment while driving on the route and at rest? What are "Polygon Boundaries" and why are they defined?

Homework. Section 1, chapter 3, topics 3.1 and 3.2.

Practical tasks.

1. Guess and correctly enter the words in the cells (task 5 at the end of topic 3.1.). From the letters in the gray cells, make up a word that is very necessary on a hike.

2. Draw from memory a diagram of your route from home to school, from the train platform to the cottage, or some other route.

3. During a trip to the country, a walk in the park, try to sketch a small section of the path using topographic signs. Ask parents to check the correctness of the assignment.

4. Draw on the diagram the area of ​​\u200b\u200bthe nearest forest where you go for mushrooms and berries. Determine for yourself, or ask local residents about what linear landmarks this site is limited to. Determine their approximate direction. Going into the forest with your parents, try to go to these landmarks. Before that, determine the direction to the north, then the direction to the linear landmark.

Poly many + gonia angle. 1 .mat. Polygon (closed or open). BAS-1. Also, I wanted the aforementioned primers such as how they draw this manner with a circle or a quadrangle and start from which polygon - external or internal. 1712. PBP 12 (1) 99. || Closed and open polygon on the ground and on the plan. BAS-1. ♦ Fortress polygon. Location of fortifications in the form of a polygon. BAS-1. Attacks from two sides to Azov should be carried out as soon as possible: the first, real, against both polygons of the bastion .. water gates and to the dock; another phos-attack - along the Don River. 1736. Siege of Azov. // SWIM 3 188. Against the projected one, to cover some small stone ones, I made three new polygons with ravelins. 1737. M. A. Muravyov Zap. // ROA 5 13. Explanation of the fortress plan. one). Two polygons, which are already here to strengthen the line a, b, c, d. 1763. Betskoy App. 13. According to the prescribed rules, constructions (compositions) were made for all regular polygons from 4 to 12 sides. 1777. Kurg. Book. military science. 55. To close the main shaft in the polygons .. assigned crescents (demi-lune) and counter-guards; flanks in all land polygons are protected by large orlions and have casemates for a horizontal ditch of defense. 1785. Potemkin Boom. 131. In proportion to this, take the Sevastopol fortification test site, which came out much less than a certain year. Vauban and Kehorn, for the former has 150, and the latter 180 toazes. 1785. Potemkin Boom. 131. The site of the fortress remains the same. The garrison corresponds to the length of the line of forts. The defense plan should be built to reduce the range. Siege of Port Arthur. // From the military past 319. || Fortress side. The position of the Yekaterinburg fortress is out of the blue: one training ground to the south, another to the north, a third to the east, the fourth to the west in the Ural Mountains. from which there are small mountains near it. 1735. Gennin Description. ural. and sib. factories. // Gray-haired Ural 340. It rarely happens that the enemy captures more than one side of the fortress with his attack: and if he covers two and three sides of the fortress (that is, three polygons) with his attack, then only to occupy the proper place under the position of the batteries and against the flanks of the attacked bastions will do this. 1744. Vauban 180. As a rule, in regular fortresses, for defense, each battalion is assigned to any training ground. Tat. Lex . // T. Chosen. 230. This fortress has six regular training grounds, and according to this proportion, for protection, there should be a garrison of twelve battalions, of which there are only three. Rumyantsev 2 110. Although there are fortresses with less than six polygons. 1830. Wessel 227.

2. obsolete A building with a polygonal base. Pavlenkov 1911. There are three large buildings of the Academy of Sciences in particular, and for the sake of the coast in such a position, as if they were part of a polygonal polygon. GS 1801 1 70.

3. The boundaries of some plot of land, taken by walking around with a goniometric tool. Pavlenkov 1911.

4. A piece of terrain specially equipped for testing technical equipment of weapons, artillery firing practice and training of technical branches of the armed forces. BAS-1. He went there to Africa, as one goes hunting, to a fencing hall or a training ground. Slovo 1879 8 2 136. Teachings in the barracks and at the training ground, dressing the soldiers, cleaning the horses - how much trouble and worry all this. Obs. 1888 4 1 249. With a crash, rumble and roar, bursting into firing, like a machine gun at a training ground .. this monster raced. Fedin Brothers. // F. 3 36. They inspected the buoys .., prepared for the landfills, carried out the landfills at sea. O. Kuchkina Voice of Ash. // Neva 2002 10 7. || ext. The regulation of the type and type of houses, the development of streets, parts of the city were an element of total police control over the life of Petersburgers, which was established under Peter, a devout preacher of the concept of a "regular" state. Petersburg has become a real testing ground for the implementation of forcibly re-educated subjects. Star 2003 5 146.

5. An open area with equipment for the manufacture of elements of prefabricated structures and parts. SIS 1985. BAS-1.

6. Garbage dump outside the city in a specially designated place. Owls. Ros. 4. 7. 1987.

7. joke, corner. Square. Mokienko 2000.

8. arrest. Platz in ITU. Mokienko 2000.

9. From the lexicon of players in role-playing games. Do not go beyond the boundaries of the polygon. Recorded 1999. Mokienko 2000. - Lex. Jan. 1806: polygon; SAN 1847: polygo/ n.


Historical Dictionary of Gallicisms of the Russian Language. - M.: Dictionary publishing house ETS http://www.ets.ru/pg/r/dict/gall_dict.htm. Nikolay Ivanovich Epishkin [email protected] . 2010 .

Synonyms:

See what a "polygon" is in other dictionaries:

    POLYGON- (Greek, from polys many, and gonia angle). 1) polygon. 2) a place outside the city where artillery exercises take place, firing from guns. 3) in fortification: a line connecting the corners of two adjacent bastions. Dictionary of foreign words included in ... ... Dictionary of foreign words of the Russian language

    polygon- autodrome, polygon, kapustin yar, shooting range, gliding track, platform, autofield Dictionary of Russian synonyms. polygon shooting range Dictionary of synonyms of the Russian language. Practical guide. M.: Russian language. Z. E. Alexandrova. 2011 ... Synonym dictionary

    Polygon 2- Genre Comedy, Parody, Horror Director Pavel Fominenko Producer Pavel Fominenko Scriptwriter ... Wikipedia

    POLYGON- POLYGON, polygon, husband. (from Greek poly many and gonia angle). 1. A large uninhabited area serving as a place for experimental or training sessions and exercises for special troops, a shooting range (military). Artillery range. 2. The location of the serfs ... ... Explanatory Dictionary of Ushakov

    polygon- POLYGON, shooting range ... Dictionary-thesaurus of synonyms of Russian speech

    Polygon- - a type of reinforced concrete production located in the open air, sometimes with a canopy (roof); is part of the concrete products factories or is an independent enterprise. [Terminological dictionary for concrete and ... ... Encyclopedia of terms, definitions and explanations of building materials

    POLYGON- (from the Greek polygonos polygonal) a piece of land or sea, intended for testing weapons, military equipment, combat training of troops ...

    POLYGON- same as polygon... Big Encyclopedic Dictionary

Usage

    If checked (neighbor_option set to IDENTIFY_NEIGHBORS in scripts), neighbor polygon information will be stored for each output feature. As shown above, the boundaries are converted to lines, taking into account intersections and common segments; two new fields, LEFT_FID and RIGHT_FID, will be added to the output feature class and set to the input polygon feature IDs to the left and right of each output line. Input feature attributes will not be supported in the output feature class. Below is a detailed analysis of the process itself and the output options:

    • In polygon geometry, the exit boundary is always drawn in a clockwise direction. If the polygon has a hole, the boundary of the hole (or inside) is always drawn in a counter-clockwise direction. Thus, for a polygon that has no neighbors to the left (outside) of its outer boundary and to the left (inside) of its hole boundary, the resulting lines will be -1 for LEFT_FID and the polygon feature ID as RIGHT_FID.
    • If the polygon contains another polygon, one output line will be created in a clockwise direction representing the common boundary, where LEFT_FID is set to the feature ID of the outer polygon and RIGHT_FID is set to the feature ID of the inner polygon.
    • If two polygons share a boundary part, one output line will be created representing the common segment. The direction of the line will be arbitrary; LEFT_FID and RIGHT_FID will be set to the ID of the left and right polygon features, respectively.
    • If a polygon overlaps another polygon, two output lines will be created representing each intersection boundary twice: the first line will represent the outer boundary of one of the overlapping polygons, so LEFT_FID is the feature ID of the polygon it intersects and RIGHT_FID will be its own polygon ID ; the second line will be in the opposite direction, splitting the other polygons, so LEFT_FID and RIGHT_FID will be the same as the other polygon feature IDs.
    • Composite features in input polygons are not supported; all output lines are simple.
  • If the checkbox Identify and store information about neighboring polygons not set (neighbor_option is set to IGNORE_NEIGHBORS in scripts), neighbor polygon information will be ignored. Each boundary of the input polygon will be recorded as a separate line feature. The compound polygon will become a compound line in the output. The attributes of the input features will be copied to the output feature class. A new field, ORIG_FID, will be added to the output and set to the ID of each line's input feature.

    For parametric (true) curve input features, the output lines will remain true curves even if they are split. Does not apply to shapefile data.

Syntax

PolygonToLine_management(in_features, out_feature_class, (neighbor_option))

ParameterExplanationData type

The input features, which must be polygons.

Feature Layer

out_feature_class

The output line feature class.

Feature Class

(additionally)

Sets whether to identify and store information about neighboring polygons.

  • IDENTIFY_NEIGHBORS - Information about neighboring polygons will be preserved in the output. If different polygon segments share a boundary with other polygons, the boundary will be split so that each uniquely stored segment becomes a line with two neighboring polygon IDs stored in the output. This value is used by default.
  • IGNORE_NEIGHBORS - Information about neighboring polygons will be ignored; the boundary of each polygon will become a line feature with the original polygon feature ID stored in the output.
Boolean

Code example

Polygon in line. Example 1 (Python window)

An example Python script to perform the Polygon To Line function, launched from a Python window in ArcGIS.

import arcpy from arcpy import env env . workspace = "C:/data" arcpy . PolygonToLine_management( "Habitat_Analysis.gdb/vegtype", "C:/output/Output.gdb/vegtype_lines", "IGNORE_NEIGHBORS" )

Polygon in line. Example 2 (standalone script)

An example Python script to perform the Polygon To Line function offline.

# Name: PolygonToLine_Example2.py # Description: Use PolygonToLine function to convert polygons to lines, # and report how many shared or overlapping boundary lines# were found. # # import system modules import arcpy from arcpy import env # Set environment settings env . workspace = "C:/data/landcovers.gdb" # Create variables for the input and output feature classes inFeatureClass = "bldgs" outFeatureClass = "bldgs_lines" # Use error trapping in case a problem occurs when running the tool try : # Run PolygonToLine to convert polygons to lines using default neighbor_option arcpy. PolygonToLine_management(inFeatureClass , outFeatureClass ) # Select lines that have LEFT_FID values ​​greater than -1 arcpy. MakeFeatureLayer_management (outFeatureClass , "selection_lyr" , " \" LEFT_FID \" > -1" ) result = arcpy . GetCount_management("selection_lyr" ) if (result . getOutput (0 ) == "0" ): print "No overlapping or shared boundary lines were found." else : print result . getOutput (0 ) + " overlapping or shared " + \ "boundary lines were found." except Exception , e : # If an error occurred, print line number and error message import traceback , sys tb = sys . exc_info ()[ 2 ] print "Line %i " % tb . tb_lineno print e . message