You are here: > ESRI Forums > arcview 3.x users discussion forums > Thread Replies

ArcView 3.x Users Discussion Forums

ArcView GIS - Core program forum

how to smooth vertices of shape theme in ar...   Alicia Christensen Feb 04, 2002
Re: how to smooth vertices of shape theme i...   Ianko Tchoukanski Feb 04, 2002
Re: how to smooth vertices of shape theme i...   Bradley Owens Dec 11, 2006
Re: how to smooth vertices of shape theme i...   Oliver Ginzler Dec 12, 2006
Re: how to smooth vertices of shape theme i...   Randall Lau Feb 04, 2002
Report Inappropriate Content • Top • Print • This Forum is closed for replies.    
Subject how to smooth vertices of shape theme in arcview 
Author Alicia Christensen 
Date Feb 04, 2002 
Message I have a theme that I want to smooth the edges on; right now they are jagged edges. It is a polygon shapefile however, and not a grid file. Is there an easier way to do this than changing and adding additional vertices one by one? Is there a way to do this in arcview? 
   
Report Inappropriate Content • Top • Print • This Forum is closed for replies.    
Subject Re: how to smooth vertices of shape theme in arcview 
Author Ianko Tchoukanski 
Date Feb 04, 2002 
Message Try EditTools extension. Its smooth function works on polyline shapefiles only. The reason is that if you smooth two neghboring polygons, a gap might appear between them. The solution is to convert your polygons to polylines, smooth the polylines and build polygons from the smoothed polylines. All the functions involved are available in EditTools 3.3. For more information visit http://www.ian-ko.com 
  http://www.ian-ko.com 
   
Report Inappropriate Content • Top • Print • This Forum is closed for replies.    
Subject Re: how to smooth vertices of shape theme in arcview 
Author Bradley Owens 
Date Dec 11, 2006 
Message Ianko, how do you go from polyline to polygon? I'm looking in the Convert tools, but I don't see this function.

thx,

brad 
   
Report Inappropriate Content • Top • Print • This Forum is closed for replies.    
Subject Re: how to smooth vertices of shape theme in arcview 
Author Oliver Ginzler 
Date Dec 12, 2006 
Message This Avenue Script is one of many samples in the installation folder of Arc View....
Try it. 
 
' Name:  View.ConvertPolyLineToPolygon
' 
' Title:  Converts polylines in the active theme to polygons.
'
' Topics:  GeoData
'
' Description:  Converts selected polylines to polygons to create a new
' shapefile.  If no features are currently selected all polylines will
' be processed.
'
' If the polylines are not closed, i.e., the first and last points are
' not identical, the user may choose to automatically close all 
' polylines. This option will move the last point to the first point.
'
' Multi-part shapes are not currently supported.   
'
' Requires: A View must be the active document, a polyline theme must
' be the active theme. Use the following as an update script:
'
'-Update script for control...
'-v = av.GetActiveDoc
'-t = v.GetActiveThemes.Get(0)
'-SELF.SetEnabled((t <> NIL) AND 
'-  (t.GetFTab.FindField("shape").GetType = #FIELD_SHAPELINE)) 
'
' Self:  
'
' Returns:  
'
' Version: 3.1 (will run with 3.0a)
'

theView    = av.GetActiveDoc
thmThemeIn = theView.GetActiveThemes.Get(0)

' Specify the output shapefile...
'
fnDefault = FileName.Make("$HOME").MakeTmp("shape","shp")
fnOutput  = FileDialog.Put( fnDefault,"*.shp","Output Shape File" )
if (fnOutput = nil) then exit end
fnOutput.SetExtension("shp")
ftbOutput = FTab.MakeNew( fnOutput, POLYGON )
ftbOutput.AddFields({Field.Make("ID", #FIELD_LONG, 8, 0)})

' Polylines must close to create polygons. The choices presented to the
' Gentle User are to automatically 'snap' the last polyline vertex to
' the first, or to skip any unclosed polylines...
'
bForceClosure = MsgBox.YesNoCancel("Force closure on all features?",
  "Convert Polyline to Polygon","TRUE")
if (bForceClosure = NIL) then exit end

' Use selected shapes if there are any, otherwise iterate
' through the entire FTab...
'
if (thmThemeIn.GetFTab.GetSelection.Count > 0) then
  colToProcess = thmThemeIn.GetFTab.GetSelection
  nRecs = colToProcess.Count
else
  colToProcess = thmThemeIn.GetFTab
  nRecs = colToProcess.GetNumRecords
end

nCount = 0
nRecAdded = 0 
fldShapeIn  = thmThemeIn.GetFTab.FindField("shape")
fldShapeOut = ftbOutput.FindField("shape")
fldIDOut    = ftbOutput.FindField("id")  
for each r in colToProcess
  nCount = nCount + 1
  av.SetStatus((nCount / nRecs) * 100)
  shpIn = thmThemeIn.GetFTab.ReturnValue(fldShapeIn,r)
  
  if (shpIn.AsList.Count > 1) then
    MsgBox.Warning("Unable to convert multi-part shape at record"++
      nCount.AsString,"Convert Polyline to Polygon")
    continue
  end 
   
  lstPoints = shpIn.AsList.Get(0)
  ptStart = lstPoints.Get(0)
  ptEnd   = lstPoints.Get((lstPoints.Count - 1))
  if (ptStart <> ptEnd) then
    if (bForceClosure) then  ' Force the close...
      lstPoints.Add(Point.Make(ptStart.GetX, ptStart.GetY))     ' modified 9/97
    else
      continue
    end
  end

  shpNew = Polygon.Make({lstPoints})
  shpNew.Clean
  
  nRecNew = ftbOutput.AddRecord
  ftbOutput.SetValue(fldShapeOut,nRecNew,shpNew)
  ftbOutput.SetValue(fldIDOut,nRecNew,nCount)
  nRecAdded = nRecAdded + 1
end

av.SetStatus(100)

if (nRecAdded = 0) then
  MsgBox.Info("No closed polylines found. Unable to convert"++
    "polylines to polygons.", "Convert Polyline to Polygon")
  exit
else
  MsgBox.Info(nRecAdded.AsString++"shapes converted.",
    "Convert Polyline to Polygon")
end

if (MsgBox.YesNo("Add shapefile as theme to a view?",
  "Convert Polyline to Polygon", true).Not) then 
  exit 
end

' Create a list of views and allow the user to choose which view to
' add the new theme to... 
lstViews = {}
for each d in av.GetProject.GetDocs
  if (d.Is(View)) then
    lstViews.Add( d )
  end
end
lstViews.Add("<New View>")
  
vweAddTo = MsgBox.ListAsString( lstViews,"Add Theme to:",
  "Convert Polyline to Polygon" ) 
  
' Get the specified view, make the theme, and add it...
if (vweAddTo <> nil) then
  if (vweAddTo = "<New View>") then
    vweAddTo = View.Make
    vweAddTo.GetWin.Open
  end 
  thmNew = FTheme.Make( ftbOutput )
  vweAddTo.AddTheme( thmNew )
  vweAddTo.GetWin.Activate
end


 
  University of Giessen
Division of Landscape Ecology and Landscape Planning
Germany 
   
Report Inappropriate Content • Top • Print • This Forum is closed for replies.    
Subject Re: how to smooth vertices of shape theme in arcview 
Author Randall Lau 
Date Feb 04, 2002 
Message Another technique to try is to split the polygon. By splitting the polygon, you draw a newer, perhaps smoother boundary that you created. Once you have the boundary that you want, then Union the two polygons back together.

Caution, if you use this technique, do not cross back and forth over the boundary too often. It may give you more problems. But, it will be faster than moving the correct vertices about.

Hope that this helps.