Jump to content

 
Photo

Select by Location - Cross more than one Side

- - - - -

  • Please log in to reply
5 replies to this topic

#1
Archmap

Archmap

    Newbie

  • New Member
  • Pip
  • 4 posts
  • United States

Hi,

I'm trying to come up with a way to select lines from a shapefile in ArcGIS 10 that transect a polygon. The built-in Select by Location tools allow for, at best, intersections or crossings (which means crossing at at least one location). I need to select lines that cross polygons at at least two locations.

Is it possible to modify the select by location tool using Python? Or would it be simpler to write my own script (and if so... any links on where to begin? My Python skills are a bit basic.)

Or, has anyone already solved this problem and can offer some sound advice?

What I'm trying to accomplish is to identify the minimum elevations from a series of contours that cross all the way through a large set of study areas delineated by polygons.

-Thanks

#2
David Medeiros

David Medeiros

    Hall of Fame

  • Validated Member
  • PipPipPipPipPipPipPip
  • 1,089 posts
  • Gender:Male
  • Location:Redwood City CA
  • Interests:Cartography, wood working, wooden boats, fishing, camping, overland travel, exploring.
  • United States

You need to select lines that intersect two polygons or lines that intersect a single polygon twice? There must be a way to construct this as a simple query without writing a script.

Can you just stack your selections? Select the first set of intersections then select from that select-set for the second intersection?

GIS Reference and Instruction Specialist, Stanford Geospatial Center.

 

www.mapbliss.com

 


#3
Archmap

Archmap

    Newbie

  • New Member
  • Pip
  • 4 posts
  • United States

I need to select lines that intersect a single polygon twice (think entering on one side and leaving on the other). Stacking (if I understand you) is what I have been doing, but I haven't come up with a set of criteria yet that fully solve my problem.

I have a long stretch of coast that I've completely segmented into many rectangular-ish sections. I have contour lines for that coast and I want to select only the lines that run all the way through at least one polygon (think barriers). In the attached image you'll see a portion of my study area (beige polygons) and contour lines (blue lines). I want to remove all those little contour lines that touch only one side or no sides. I can whittle down the numbers by removing contours of a minute size, and then selecting from the remaining contours those that do not touch any edges and removing those. That's a decent work-around, but it doesn't solve my problem entirely. I figure that there has to be a real solution to this dilemma.

Conversely it would be acceptable to select polygons that are completely crossed by a contour line. I could work with that, but then there's the same problem. How do you select polygons that are intersected on at least two sides by a line?

-Thanks

You need to select lines that intersect two polygons or lines that intersect a single polygon twice? There must be a way to construct this as a simple query without writing a script.

Can you just stack your selections? Select the first set of intersections then select from that select-set for the second intersection?

Attached Files


Edited by Archmap, 07 December 2010 - 02:34 PM.


#4
jrat

jrat

    Master Contributor

  • Validated Member
  • PipPipPipPip
  • 143 posts
  • Gender:Male
  • Location:Hagerstown, MD
  • United States

What if you took your polygons and converted them to lines then split the new line feature so you had a left and right boundary line. Could you then do a selection of left boundary lines then a select from selection using the right boundary line.

#5
heath b

heath b

    Key Contributor

  • Validated Member
  • PipPipPip
  • 71 posts
  • Gender:Male
  • Location:Portland, OR
  • Interests:the great outdoors, bouldering, martinis, unusual graphical representation
  • United States

I assume that you are really only concerned with contour lines that cross the width of each polygon (as opposed to contour lines that loop back and intersect the same line segment). It also appears that your polygons are all of an even width (or at least very close to it). If those are both true, then you could try something like this:

Clip the contour lines to the polygons.
Use the 'Features to Vertices' tool on these new line segments and specify that you want BOTH ENDS.
Use 'Add XY Coordinates' tool to add coordinate values to this point file.
Perform 'Summary Statistics' on the point file table, where your statistic is a RANGE of the 'X Value' using the line segment ID as your Case Field.
You can join this table back to your line segment file and select only the segments that have a RANGE value that is the equivalent (or within a select tolerance) of your polygon widths.

Of course, this will only work if your polygons are rectangles of equal width, but even if they are slightly irregular or of varying widths, you could perform some xy calculations on the polygons to get the shortest and longest 'X' widths for each polygon and spatially join your line segments to the polygons and select by line segments whose 'RANGE' values fall within the the tolerance of shortest and longest 'X' widths for each polygon.

I haven't actually done this exact analysis before, but it seems that theoretically it should work.

Good luck,
Heath

#6
Archmap

Archmap

    Newbie

  • New Member
  • Pip
  • 4 posts
  • United States

There have been some interesting ideas bandied about, but I must say, yours sounds as if it may be the one. Yes, my polygons are all of equal width and yes, contours that cross the width as opposed to looping back are the ones I want (though I was willing to accept the looping as unavoidable error).

I'll give this a try and post back if I get it to work.

Thanks again.

-Richard

I assume that you are really only concerned with contour lines that cross the width of each polygon (as opposed to contour lines that loop back and intersect the same line segment). It also appears that your polygons are all of an even width (or at least very close to it). If those are both true, then you could try something like this:

Clip the contour lines to the polygons.
Use the 'Features to Vertices' tool on these new line segments and specify that you want BOTH ENDS.
Use 'Add XY Coordinates' tool to add coordinate values to this point file.
Perform 'Summary Statistics' on the point file table, where your statistic is a RANGE of the 'X Value' using the line segment ID as your Case Field.
You can join this table back to your line segment file and select only the segments that have a RANGE value that is the equivalent (or within a select tolerance) of your polygon widths.

Of course, this will only work if your polygons are rectangles of equal width, but even if they are slightly irregular or of varying widths, you could perform some xy calculations on the polygons to get the shortest and longest 'X' widths for each polygon and spatially join your line segments to the polygons and select by line segments whose 'RANGE' values fall within the the tolerance of shortest and longest 'X' widths for each polygon.

I haven't actually done this exact analysis before, but it seems that theoretically it should work.

Good luck,
Heath






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

-->