Could you please add the the following script (was done
by me when I was in Amman, pls review).
'Line from GPS-coordinates'.
Advantage: You don't need an extra table to create a
lina after the GPS has recorded trackpoints.
Thanks
Thomas from Aleppo
' Create line theme from point shapefile
' (c) 2001 DORSCH Consult
' Messagebox which explains the usage of the Script
' Msgbox.Report("Create line theme from GPS points
shapefile."+NL+
' NL+"Required: Point shapefile incl. point_ID"+
' NL+"Optional: Node_Z"+NL+
' NL+"Required: DBF Table incl. From_ID & To_ID"+
' NL+"Optional: Additional Line Info (Output File)",
"Information")
' Get a theme
viewActive = av.GetActiveDoc
themeList = viewActive.GetThemes
PointTheme = Msgbox.Choice(themeList, "Select a Theme
containing the GPS Points.", "Select a Theme")
if(PointTheme = nil)then
exit
end
' Get Column with Node_IDs
thmPoint = viewActive.findTheme(PointTheme.asString)
ftbPoint = thmPoint.GetFTab
ftbFieldList = ftbPoint.GetFields
fldPointID = MsgBox.ListAsString(ftbFieldList,"Choose
Node_ID:","Field List in:"++ftbPoint.AsString)
if(fldPointID = nil)then
exit
end
' Get Column with shape informations
fldPointShape = ftbPoint.FindField("Shape")
' Initialize loop parameters
numCounter = 0
numTotal = ftbPoint.GetNumRecords
' ???
pll= Polyline.MakeNull
clsPolyline = PolyLine
' Open new shapefile and initialize properties
def = av.GetProject.MakeFileName("theme", "shp")
def = FileDialog.Put(def, "*.shp", "New Section Theme")
if (def = nil) then
exit
end
ftbLine = FTab.MakeNew(def, clsPolyline)
'Add Point numbers
fldClonedPointID = fldPointID.clone
ftbLine.addFields({fldClonedPointID})
'fldLenght.Make("Lenght",#FIELD_FLOAT, aWidth,
aPrecision )
thmLine = FTheme.Make(ftbLine)
viewActive.AddTheme(thmLine)
thmLine.SetActive(TRUE)
thmLine.SetVisible(FALSE)
viewActive.SetEditableTheme(thmLine)
av.GetProject.SetModified(true)
fldLineShape = thmLine.getFTab.findField("Shape")
for each recPoint in ftbPoint
'system.echo("point")
pntFrom = ftbPoint.returnValue(fldPointShape,
recPoint)
pntTo = ftbPoint.returnValue(fldPointShape,
recPoint+1)
pllLine = Polyline.Make({{pntFrom, pntTo}})
recLineShape = ftbLine.addRecord
ftbLine.setValue(fldLineShape, recLineShape, pllLine)
ftbLine.setValue(fldClonedPointID, recLineShape,
ftbPoint.returnValue(fldPointID,recPoint))
av.setStatus((numCounter/numTotal)*100)
numCounter = numCounter+1
if (numCounter = (ftbPoint.GetNumRecords-1)) Then
break
end
end
av.clearStatus
'cleaning up
thmLine.getFTab.setEditable(FALSE)
thmLine.setVisible(TRUE)
old dc processing,