I've been stuck on a situation recently where my company's data has to be integrated with another.
Basically there are two point shapefiles comprising of >50000 points, and as shown in the image below, one data set lies between the other spatially.
The output I need would be around <100 polylines based on a unique identifier within the two datasets.
The problem occurs because once they are merged, the FID number (which I would usually use on the Line type within the points to line tool) no longer has any spatial use as my own dataset is at the top of the attribute table and the other at the bottom (no longer in spatial order).

Can anyone think of a solution to this?
A polyline tool based on proximity would be perfect for this situation but I am unaware of one existing... (I've already thought about sorting by northing/easting, but that creates problems when the data does not go in a continuous orientation)

enter image description here


Providing you can differentiate between group of points to form a polyline (distance tolerance?), the following works:

  1. Find point for which total of distances to other points in the group is maximum. This makes a first point of target polyline (first point in the array)
  2. Iterate through the rest of the points to find nearest, add to the array, etc.
  3. Convert array of points into polyline.

The solution works fine for lines shown in your example, i.e. with the ends far apart and no sharp bends. To handle corners I usually split points into groups at the corner.

  • I can post the script which 1.Connects points to make polyline. Makes 1 line at a time 2. Tool assumes that 1st layer in Table of Content is TARGET polyline feature class, 3. Second layer in TOC is SOURCE point fc. 4. If no selection found in SOURCE layer, works on entire dataset – FelixIP Aug 5 '14 at 1:44

add a field, [draworder] calculate the fid into it.
Then use it to draw the polylines.
BTW ETTOOLs has a good tool for this.
enter image description here

  • Thank you for your answer, but i'm not sure that will solve the issue. For example: before the merge of the datasets... the FID order of the two datasets was : 1,2,3,4,5,1,2,3,4,5,6,7,8,9,10,6,7,8,9,10... whereas now they are 1,2,3,4,5,6,7,8,9,10,1,2,3,4,5,6,7,8,9,10. If I could use the FID before the merge then that would have solved it, but after the merge the data sets have been grouped together so are now no longer in "spatial" order. any thoughts? – user32317 Aug 4 '14 at 15:10
  • Do you still have the pre-merged data? That is what I meant. Create the lines for each and then merge. – Brad Nesom Aug 4 '14 at 16:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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