Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have 2 layers, one representing streets, and one representing pipes. The pipe layer has a street field that I want it to be automatically filled (I want the pipe to show the street that it's on) I tried performing a spatial join based on 'closest' but I encountered the following problem: many pipes never intersect the center of the streets they're on (they are usually parallel), and, at the spatial join, those respective pipes don't get the needed data from the street they go along but from the ones that are perpendicular (cause they intersect the pipes, so they have one point that is closest).

share|improve this question

I've face a similar problem and created a programmatic tool that would:

  1. Shorten my street centerline. Here I would take it from .4 to .6 for example (in this case I would consider only the dashes)



    After shortening


  2. I would buffer it for a small ammout, let's say 10% of the original street lenght. Imagine that you are buffering only the dashes in the schematic "drawing above".

  3. Try to intersect it with pipes.

You can repeat 2 and three until you've found a certain number of pipes. The idea for shortening the center line is to eliminate the cases where you other perpendicular lines that you do not want.

Check a less ugly scheme:

enter image description here

Another approach is to just buffer, intersect and compare the angles. You can safely set a threshold of what "parallel" is. You will never have straight and parallel lines in this cases (some will be parallel, but that depends on digitizing). You take only the pipes that have similar angles to your centerline.

share|improve this answer
Thanks for the answer, I hoped for a different answer, I will try to do something alike. – tudorbarascu Jul 25 '11 at 4:14
I'll see if I can find some code to help you. This method improves confidence of the results, it's not the most pratical, but it works great on regular grids. The more irregular the street network the less confidence you can have with it. – George Jul 25 '11 at 14:29

You could try using the Near geoprocessing tool:

Determines the distance from each feature in the input features to the nearest feature in the near features, within the search radius.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.