You are here: > ESRI Forums > arcgis desktop discussion forums > Thread Replies

ArcGIS Desktop Discussion Forums

ArcGIS Desktop - Data Management (General) forum

ArcGIS 9.2 - tool to detect unclosed polyli...   Vincent Launstorfer Mar 19, 2007
Re: ArcGIS 9.2 - tool to detect unclosed po...   Miles Hitchen Mar 19, 2007
Re: ArcGIS 9.2 - tool to detect unclosed po...   Vincent Launstorfer Mar 19, 2007
Re: ArcGIS 9.2 - tool to detect unclosed po...   Miles Hitchen Mar 19, 2007
Re: ArcGIS 9.2 - tool to detect unclosed po...   Vincent Launstorfer Mar 19, 2007
Re: ArcGIS 9.2 - tool to detect unclosed po...   John Sobetzer Mar 19, 2007
Re: ArcGIS 9.2 - tool to detect unclosed po...   Miles Hitchen Mar 19, 2007
Re: ArcGIS 9.2 - tool to detect unclosed po...   Vincent Launstorfer Mar 20, 2007
Re: ArcGIS 9.2 - tool to detect unclosed po...   Vincent Launstorfer Mar 20, 2007
Re: ArcGIS 9.2 - tool to detect unclosed po...   Miles Hitchen Mar 20, 2007
Re: ArcGIS 9.2 - tool to detect unclosed po...   Ianko Tchoukanski Mar 20, 2007
Re: ArcGIS 9.2 - tool to detect unclosed po...   Miles Hitchen Mar 20, 2007
Re: ArcGIS 9.2 - tool to detect unclosed po...   Vincent Launstorfer Mar 21, 2007
Re: ArcGIS 9.2 - tool to detect unclosed po...   Nishal Palawan Oct 13, 2009
Re: ArcGIS 9.2 - tool to detect unclosed po...   C Martin May 29, 2009
Report Inappropriate Content • Top • Print • This Forum is closed for replies.    
Subject ArcGIS 9.2 - tool to detect unclosed polyline (in order to convert to polygon) 
Author Vincent Launstorfer 
Date Mar 19, 2007 
Message Hi!

Working with ArcGIS 9.2, the ArcView edition (and not the full ArcInfo), I am looking for a tool (or ArcGIS functionality) to detect where polyline are not closed in order to build polygon (after a cleaning).

For example, I have an unclosed polyline for a lake but it doen't convert to polygon until I find and fix the polyline. Thank you 
  Vincent Launstorfer
GIS Specialist & Midstream Cartographer
IHS Energy
Geneva - Switzerland 
   
Report Inappropriate Content • Top • Print • This Forum is closed for replies.    
Subject Re: ArcGIS 9.2 - tool to detect unclosed polyline (in order to convert to polygon) 
Author Miles Hitchen 
Date Mar 19, 2007 
Message Hi,

You can achieve this using an Advanced Calculator script (see below).

First, add a text field "Closed", length=1 to your polyline featureclass. Now use the script below to populate the "Closed" field, put sClosed in the text box below the Advanced window (see attached image).

Now you can do an Attribute selection where "Closed" = 'N' and this will select all polylines that aren't closed.

Hope that helps,
Miles.
 
 
dim pPolyline as ipolyline
dim sClosed as string

set pPolyline = [Shape]
if pPolyline.IsClosed then sClosed = "Y" else sClosed = "N"
 
  Miles Hitchen
Software Engineer
Geospatial Team
Ordnance Survey
UK
 
  Calculator.JPG (opens in new window)
 
Report Inappropriate Content • Top • Print • This Forum is closed for replies.    
Subject Re: ArcGIS 9.2 - tool to detect unclosed polyline (in order to convert to polygon) 
Author Vincent Launstorfer 
Date Mar 19, 2007 
Message Thank you for help

Unfortunately, it didn't work! Moreover, my lakes I'd like to convert to polygon are not made of just one polyline almost close. This would be easier in fact.

Instead, there are many polylines (seperate features with different attributes) that all together can eventually make a lake. The problem is that, very often, these polylines do not join each other perfectly (digitizing problems!) and it does exist gaps I need to fix before converting to polygon.

When polylines do not convert to polygon, it exists a potential problem and I am looking for a tool to detect (highlight for example) where gaps exist to close my polylines manually (and best automatically, maybe with a tolerance). Hope it is understandable...
 
  Vincent Launstorfer
GIS Specialist & Midstream Cartographer
IHS Energy
Geneva - Switzerland 
   
Report Inappropriate Content • Top • Print • This Forum is closed for replies.    
Subject Re: ArcGIS 9.2 - tool to detect unclosed polyline (in order to convert to polygon) 
Author Miles Hitchen 
Date Mar 19, 2007 
Message Hi Vincent,

Try using the Dissolve Tool (under Data Management, Generalization), don't specify any fields, make sure you un-tick the "multipart" box and set the Cluster Tolerance on the Environment Settings appropriately. See the attached image.

Cheers,
Miles.
 
  Miles Hitchen
Software Engineer
Geospatial Team
Ordnance Survey
UK
 
  Dissolve.JPG (opens in new window)
 
Report Inappropriate Content • Top • Print • This Forum is closed for replies.    
Subject Re: ArcGIS 9.2 - tool to detect unclosed polyline (in order to convert to polygon) 
Author Vincent Launstorfer 
Date Mar 19, 2007 
Message Seems interesting this tolerance setting using Dissolve... Need to test it on my data.

Thank you Miles 
  Vincent Launstorfer
GIS Specialist & Midstream Cartographer
IHS Energy
Geneva - Switzerland 
   
Report Inappropriate Content • Top • Print • This Forum is closed for replies.    
Subject Re: ArcGIS 9.2 - tool to detect unclosed polyline (in order to convert to polygon) 
Author John Sobetzer 
Date Mar 19, 2007 
Message Sometimes if you are in edit mode and the task is set to modify feature, just by selecting the line and looking for the red endpoints along it you can find the gaps. Other times if you use a tool that shows nodes you can find the gaps. ET Geowizards has several line tools that might help you as well. 
   
Report Inappropriate Content • Top • Print • This Forum is closed for replies.    
Subject Re: ArcGIS 9.2 - tool to detect unclosed polyline (in order to convert to polygon) 
Author Miles Hitchen 
Date Mar 19, 2007 
Message No probs Vincent,

Let me know if it solves your problem.

Cheers,
Miles.
 
  Miles Hitchen
Software Engineer
Geospatial Team
Ordnance Survey
UK
 
   
Report Inappropriate Content • Top • Print • This Forum is closed for replies.    
Subject Re: ArcGIS 9.2 - tool to detect unclosed polyline (in order to convert to polygon) 
Author Vincent Launstorfer 
Date Mar 20, 2007 
Message Hi Miles!

Using the dissolve tool with tolerances does not seem to work! Here is attached a small sample of my data in .shp if it helps... Instead of finding a solution to fix automatically these polylines (with all the potential errors that can be generated), I would prefer to detect and fix these dangle/miss polylines manually one by one. The ideal would be a tool to automatically detect such conflicts and you could fix/correct the source data using a kind of interactive list to spot conflict one by one (I am surprised that such tool are not part of the ArcGIS package!). I have dozens (or hundreds) of these polylines and I'd prefer to correct the database data for not having such problems in the future.

Hope I was understandable... Thank you 
  Vincent Launstorfer
GIS Specialist & Midstream Cartographer
IHS Energy
Geneva - Switzerland 
   
Report Inappropriate Content • Top • Print • This Forum is closed for replies.    
Subject Re: ArcGIS 9.2 - tool to detect unclosed polyline (in order to convert to polygon) 
Author Vincent Launstorfer 
Date Mar 20, 2007 
Message Oups, the shape file! 
  Vincent Launstorfer
GIS Specialist & Midstream Cartographer
IHS Energy
Geneva - Switzerland 
  sample.zip (opens in new window)
 
Report Inappropriate Content • Top • Print • This Forum is closed for replies.    
Subject Re: ArcGIS 9.2 - tool to detect unclosed polyline (in order to convert to polygon) 
Author Miles Hitchen 
Date Mar 20, 2007 
Message Hi Vincent,

You're right, it doesn't work - sorry. If you have network analyst then you can create a network from your polylines and then check for any dangles. If you haven't got network analyst I have some code somewhere that does a similar thing, I'll dig it out for you and post later.

Cheers,
Miles.
 
  Miles Hitchen
Software Engineer
Geospatial Team
Ordnance Survey
UK
 
   
Report Inappropriate Content • Top • Print • This Forum is closed for replies.    
Subject Re: ArcGIS 9.2 - tool to detect unclosed polyline (in order to convert to polygon) 
Author Ianko Tchoukanski 
Date Mar 20, 2007 
Message Check the free Polyline To Polygon function of ET GeoWizards (http://www.ian-ko.com). It allows you to force closure of the polylines using a tolerance. 
  http://www.ian-ko.com 
   
Report Inappropriate Content • Top • Print • This Forum is closed for replies.    
Subject Re: ArcGIS 9.2 - tool to detect unclosed polyline (in order to convert to polygon) 
Author Miles Hitchen 
Date Mar 20, 2007 
Message Hi Vincent,

If you're still just looking for a method that "indicates" where the possible edits need to be made then the following method will work:

1. Use Ian-Ko's Polyline to Point tool, and just specify "endpoints" of the polyines. This will create a new shapefile of points that are the From and To points of your polylines.

2. Create a new mxd and add you polyline layer and the newly created point layer to the map. Make sure the point layer is the first layer.

3. Add an Integer field "LineCount" to this new Point shapefile and use the Advanced Field Calculator script below to populate the "LineCount" field.

4. Now create a Definition Expression on the Point layer, as follows:

"LineCount" > 1

5. Now, where ever there is a point displayed, this is a polyline that may need editing.

Hope that helps,
Miles.

PS - If you don't want to use Ian-Ko's tools then I have a very simple script to create the EndPoint shapefile, so let me know.

 
 
' Modify the following value, it's the search tolerance for the polylines
Const TOLERANCE = 100
Static pMxDoc As IMxDocument
Static pFtrLyr As IFeatureLayer
Static pFtrCls As IFeatureClass
Static pSpFltr As ISpatialFilter
Dim pTopOp As ITopologicalOperator
Dim lCnt As Long

    If pMxDoc Is Nothing Then
        Set pMxDoc = ThisDocument
        Set pFtrLyr = pMxDoc.FocusMap.Layer(1)
        Set pFtrCls = pFtrLyr.FeatureClass
        Set pSpFltr = New SpatialFilter
        pSpFltr.SpatialRel = esriSpatialRelIntersects
    End If
    
    Set pTopOp = [Shape]
    Set pSpFltr.Geometry = pTopOp.Buffer(TOLERANCE)
    lCnt = pFtrCls.FeatureCount(pSpFltr)
        
' Put lCnt in the box below the Advanced Window
 
  Miles Hitchen
Software Engineer
Geospatial Team
Ordnance Survey
UK
 
   
Report Inappropriate Content • Top • Print • This Forum is closed for replies.    
Subject Re: ArcGIS 9.2 - tool to detect unclosed polyline (in order to convert to polygon) 
Author Vincent Launstorfer 
Date Mar 21, 2007 
Message Thank you, you lead me to a good solution!

Using ET GeoWizards, I first converted my polylines to point (only nodes). After, I calculated the shortest distance from each point to the closest using a tool available on ESRI France (the shortest point distance within ET GeoWizards does not seem to work with a single layer). Then, all topologicaly correct nodes have a distance of 0 because they are exactly on the node of the next polyline... but all the remaining nodes with a shortest distance different than 0 reveal potentiel problems. Using the attribute table of the layer, I can zoom on each nodes presenting a problem and correct my data. Afterwards, all the polygons close proprely using ET GeoWizards. This techniques is maybe not the best but I can fix my data now.

Despite having done some VBA in the past, your sample code did not really work to spot the problems. Sorry! Also, somebody suggested using FME to detect such conflicts. And, the Clean Dangling Nodes on ET GeoWizards seems interesting but does not work with more than 100 features in the free edition.

Thank you 
  Vincent Launstorfer
GIS Specialist & Midstream Cartographer
IHS Energy
Geneva - Switzerland 
   
Report Inappropriate Content • Top • Print • This Forum is closed for replies.    
Subject Re: ArcGIS 9.2 - tool to detect unclosed polyline (in order to convert to polygon) 
Author Nishal Palawan 
Date Oct 13, 2009 
Message Hello

Do you have a download link for the ESRI France tool you specify? This would be very useful.

Regards

npalawan@gmail.com 
   
Report Inappropriate Content • Top • Print • This Forum is closed for replies.    
Subject Re: ArcGIS 9.2 - tool to detect unclosed polyline (in order to convert to polygon) 
Author C Martin 
Date May 29, 2009 
Message Miles, your solution in step 2 worked for me in hunting down 1 pesky segment out of thousands of lines, great solution!!