select features within boundary

2111
13
04-11-2016 09:43 AM
OzKhan
by
New Contributor III

Hi all,

I am using basic version of ArcMap. I would like to extract only the portion of purple polygon inside the line boundary. How can I do that?

(The purple is ROW and the the blue line is the proposed road layout. I am trying to plot the impacted ROW.)

Capture.JPG

0 Kudos
13 Replies
DarrenWiens2
MVP Honored Contributor

You need to convert the line to a polygon (perhaps using Feature To Polygon, I use ET GeoWizards) and then Clip or Intersect.

edit: is your ROW a polyline or polygon feature class? If polygon, just Clip or Intersect.

OzKhan
by
New Contributor III

ROW is polygon. While the road layer is polyline. Its not doing what I want...

Capture.JPG

0 Kudos
DarrenWiens2
MVP Honored Contributor

What is it doing?

0 Kudos
OzKhan
by
New Contributor III

Well actually I tried to convert the polyline to polygon using GeoWizards like you advised. However, it only converts maybe those lines that do not have gaps. How can I close all the line gaps first to convert to polygon?

(it only converted the inscribed circle to polygon)

Capture.JPG

0 Kudos
DarrenWiens2
MVP Honored Contributor

Yes, you do need closed polylines. If ET GeoWizards Polylines to Polygons tool doesn't work, go to the Build Polygons tool in the Polygon toolset and follow those instructions.

0 Kudos
OzKhan
by
New Contributor III

Capture.JPGHave a lot of lines...

0 Kudos
DarrenWiens2
MVP Honored Contributor

Hmmm the dialog gives you an option (register the product). You could convert polylines to polygons using Python geometry objects, but I'm somewhat pressed for time at the moment.

0 Kudos
DarrenWiens2
MVP Honored Contributor

Here is at least most of what you'd need to convert polyline to polygon via Python:

>>> in_lines = "open_lines" # input lines

... sr = arcpy.Describe(in_lines).spatialReference # CRS

... out_polys = [] # output list

... with arcpy.da.SearchCursor(in_lines,'SHAPE@',spatial_reference=sr) as cursor: # loop through lines

...     for row in cursor: # for each record

...         new_polyline_array = arcpy.Array()

...         for part in row[0]: # for each geometry part, if multipart

...             new_polyline_part_array = arcpy.Array()

...             for pnt in part: # for each vertex

...                 new_polyline_part_array.add(pnt) # add the vertex to the array

...             if not part[0].equals(pnt): # check if part is closed

...                 new_polyline_part_array.add(part[0]) # if not, close it

...             new_polyline_array.add(new_polyline_part_array) # add the parts to the output list

...         out_polys.append(arcpy.Polygon(new_polyline_array,sr)) # convert the output list to polygon objects

... arcpy.CopyFeatures_management(out_polys,r'in_memory\out_polys') # write to disk

OzKhan
by
New Contributor III

I am not much into programming. However, I tried a different approach and it worked.

1. I used DISSOLVE to convert all the polylines back to polylines. This takes care of all the gaps.

2. Used the ET GioWizards tool to convert the newly created polylines to polygon.

3. Used clipping features to selet only those that are impacting.

Thanks for all the help and suggestions...