I have two separate polyline shapefiles where the second was created by editing the records of the first one. (in the first file the line is in a different position than the other and have common unique records in the table).

Is there a way to extend the edges of a line and join the ends of the other one, without moving some of the existing vertices, to create polylines which close together for the creation of polygons?

I seek to do this using ArcGIS Desktop.

To go from what is shown in picture ex1 to thiw whis is shown in ex2

enter image description here

  • 1
    which software are you using? – MrXsquared Jan 6 '19 at 21:16
  • ArcGIS and QGIS – sfgt Jan 6 '19 at 21:50
  • I've retrofitted the scope of this question to match its first answer and prevent it being too broad. If you wish to also ask about QGIS then fell free to do so in a separate question. – PolyGeo Jan 7 '19 at 0:51

This can be done and relies on the fact that they share a common line ID. If for example the top blue line is ID 10 then its associated red line should also be 10, this way you take away the ambiguity of which blue line a read line is associated with.

Assuming that is the case then all you need to do is:

  1. Extract blue line end points.
  2. Insert these points into their respective ends of the red line.
  3. Call the Features to Polygon tool to close and form a polygon.


To script this logic in an ArcGIS environment have a look at the help file on writing geometries. It demonstrates the use of a cursor to access a geometry and how to build polylines. You need to explore how to read geometries to extract end points.

  • I forgot to say that the real file has thousand records , so the manualy processing is not an option. – sfgt Jan 6 '19 at 23:03
  • 1
    Was not suggesting you do this manually, you would script it in python. I outlined the basic logic to solve this problem. – Hornbydd Jan 6 '19 at 23:29
  • Any help on this? – sfgt Jan 7 '19 at 8:28
  • @sfgt see edit. – Hornbydd Jan 7 '19 at 9:35
  • I looked them but i didn't understand the way. I would appreciate if you could suggest me any guide or tutorial for beginner user in script editing. – sfgt Jan 8 '19 at 11:26

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.