How do I join lines end-to-end

5069
22
Jump to solution
06-26-2015 10:54 AM
JohnWarden
New Contributor III

I am using lat/lon coordinates to map points, then using the "Points to Line" tool to connect the points into a line, such as a road. The lat/lon coordinates are being generated separately for each county in the U.S.. Where the resulting lines are supposed to meet at the county boundary there is a small gap. The attached map illustrates the problem.

I have the same small gap where lines are supposed to join together within a county, which is also illustrated in the attachment.

Bearing in mind I will have thousands of instances where line pairs need to be joined, is there a way to do this with a few commands, or perhaps with a custom tool built in Modelbuilder.

If it helps, the line ends that need to be joined will always be very close together to begin with, they just won't be touching, so any procedure that involves performing an action based on proximity would probably work.

0 Kudos
1 Solution

Accepted Solutions
DanPatterson_Retired
MVP Esteemed Contributor

Weird...I couldn't do it with the shapefile that you sent, so I right-clicked on the file, data export data, made a new shapefile, used the extend tool with 1000 ft (way too much) and it worked.  Seph's idea requires a value table to specify the relationship, I didn't check it out.

As another suggestion, it may be quicker and easier to edit the locations within the spreadsheet or the output file to ensure that the traversing lines have a common point, but that will depend upon your data structure.  Give it a try John

View solution in original post

0 Kudos
22 Replies
DanPatterson_Retired
MVP Esteemed Contributor

For ArcMap 10.2 or 10.3 and with a Standard or Advanced license...your problem may be solved by using

Extend Line—Help | ArcGIS for Desktop but I am sure you have probably searched this in the help and are looking for a 3rd party solution like ET Geotools which may have limits on free tools.

XanderBakker
Esri Esteemed Contributor

I posted some Python code in this thread: Connecting Discontinuous Line Segments . Not sure if that would work for your case. Use with a copy of your data.

SepheFox
Frequent Contributor

The extend line tool may help you, but you could also try the Snap tool from the editing toolset (ArcGIS Help 10.1 ). The extra utility of this tool is the ability to snap to line endpoints, which you might find more useful.

JohnWarden
New Contributor III

Extend Line looks like the solution, but nothing happens when I run it with a specified distance. I put in 300 feet as the distance limit (the lines I want to connect are no more than 150 feet apart) and run the tool, but the map does not change. If I run with no distance limit the tool works, but the resulting map is a mess and not what I need. It's connecting lines all over the place, not just where I need it.

The Python code is way beyond my skill set, but thanks for the info.

Any thoughts as to  why Extend Line isn't producing the desired result?

0 Kudos
DanPatterson_Retired
MVP Esteemed Contributor

This is assuming of course that you are using a physically projected file in a coordinate system suitable for your area...such as State Plane, UTM etc which are measured in feet...and not one in decimal degreed (which would be worse).  If the units are in meters and you specified 50 feet, you will come up short since 3ish feet is 1 meter-ish.  Sooo try extending your distance AND check your coordinate system and its units...and this has nothing to do with..."I set the data frame tooo...." if just makes the data look like you want it, and not what it is.  Keep us posted.

0 Kudos
JohnWarden
New Contributor III

I was using a projected file, but changed it t to NAD_1983_NSRS2007_StatePlane_Georgia_East_FIPS_1001_Ft_US just to make sure (the data are in the north Atlanta area). Set the distance to 300 feet which is twice the size of the gap and it still doesn't work.

0 Kudos
DanPatterson_Retired
MVP Esteemed Contributor

Hmmmmm looking at the image, you might want to give the snap point tool a try with the warning that it will densify the input line in order not to affect the overall geometry of the lines.  Have a good read for both the files.  Surely someone must have come up with a tool for stitching boundary files together?.  I can see it if there was a change in the central meridian as you go from zone to zone, but that difference is a bit much...unless the datum of one counties data is different than the others...ie the old NAD27 versus Nad83 issue, but you have gaps at both ends of that sample middle line.  I will keep looking but examine the snap tool in detail

0 Kudos
JohnWarden
New Contributor III

Thanks Dan. I as understand it, the snap tool is used on a small number of lines at one time. I’ll have thousands to work on, so if that is the case, it is not a good solution.

0 Kudos
DanPatterson_Retired
MVP Esteemed Contributor

​Ok... lets backtrack

  • data are collected using gps in long/lat coordinates.... are then projected using the Project tool in arctoolbox to get them out of decimal degrees?
  • you mention they are done by county...no humor me...the county files are merged together into one file PRIOR to doing any attempt at snapping them? if not, you can't snap between files using the listed tools
  • can you select just those 3 lines in your image...export to a shapefile, zip the shapefile and post it as an attachment so 'we' can get our hands on it for testing?

Have a look at the first 2 bullets...do the third if you can...i hate nagging problems over the weekend.

0 Kudos