Vannak ugye térképek a neten. Sokat elérhetünk Arc/Info Ungenerate formátumban. Például itt egy világtérkép. Ez a formátum azonban pontok halmaza csak, nem használható közvetlenül. Ha az ArcView-be tötenénk, itt van egy script erre a célra.
' Generate2Shape
' Originally based on GPS2Shape by GAT, GEODATA AS
' Converts a file with ARC/INFO Generate format to a AV2 Shape file
'
' Ver. 1 by GAT, GEODATA AS Dec, 28 1994
' ARC/INFO Generate format for lines implemented
' Format:
' ID
' x,y
' .
' .
' x,y
' END
' ID
' x,y
' .
' .
' x,y
' END
' END
‘ Choose the Generate file to convert to shapefile…
genName = FileDialog.Show(“*.*”,”Generate File”,”Select Generate File to Convert”)
if (genName = nil) then
exit
end
genFile = LineFile.Make(genName, #FILE_PERM_READ)
totalRecs = genFile.GetSize
‘ Specify the output shapefile…
‘
defaultName = FN.Make(“$HOME”).MakeTmp(“shape”,”shp”)
shpName = FileDialog.Put( defaultName,”*.shp”,”Output Shape File” )
if (shpName = nil) then
exit
end
shpName.SetExtension(“shp”)
‘ Specify which kind of shapefile to create and make the new FTab…
‘ In current version (1.0) only line
‘
type = MsgBox.ChoiceAsString({“Line”},
“Convert coordinates to:”, “Generate Convert” )
if (type = Nil) then
exit
end
if (type = “Point”) then
shpFTab = Ftab.MakeNew(shpName,Point)
elseif (type = “Line”) then
shpFTab = FTab.MakeNew(shpName, Polyline)
elseif (type = “Polygon”) then
shpFTab = FTab.MakeNew(shpName, Polygon)
end
fields = List.Make
fields.Add(Field.Make(“ID”, #FIELD_LONG, 4, 0))
shpFTab.AddFields(fields)
shpField = shpFTab.FindField(“Shape”)
idField = shpFTab.FindField(“ID”)
genRec = 0
av.ShowStopButton
av.ShowMsg(“Converting”++genName.GetBaseName+”…”)
‘ If the user has chosen ‘Point’ then the FTab is written here in the
‘ while loop. Otherwise if ‘Line’ or ‘Polygon’ has been chosen we
‘ collect coordinates in the loop for writing to the FTab later…
while (true)
buf = genFile.ReadElt
if (buf = Nil) then
break
end
if (buf = “END”) then
break
end
if ((type = “Line”) or (type = “Polygon”)) then
pointList = List.Make
theID = buf
buf = genFile.ReadElt
end
while (true)
genTokens = buf.AsTokens(“,”)
if (type = “Point”) then ‘ write points to FTab…
theID = genTokens.Get(0)
thePoint = genTokens.Get(1).AsNumber@genTokens.Get(2).AsNumber
rec = shpFTab.AddRecord
shpFTab.SetValueNumber( idField, rec, theID.AsNumber )
shpFTab.SetValue( shpField, rec, thePoint )
elseif (type = “Line”) then ‘ collect points defining line…
thePoint = genTokens.Get(0).AsNumber@genTokens.Get(1).AsNumber
pointList.Add( thePoint )
elseif (type = “Polygon”) then ‘ collect points defining polygon…
thePoint = genTokens.Get(1).AsNumber@genTokens.Get(2).AsNumber
pointList.Add( thePoint )
end
genRec = genRec + 1
progress = (genRec / totalRecs) * 100
proceed = av.SetStatus( progress )
if (proceed.Not) then
av.ClearStatus
av.ShowMsg( “Stopped” )
exit
end
buf = genFile.ReadElt
if (buf = Nil) then
break
end
if (buf = “END”) then
break
end
end
‘ If Line or Polygon we still need to create FTab…
‘
if (type = “Line”) then
rec = shpFTab.AddRecord
shpFTab.SetValueNumber( idField, rec, theID.AsNumber)
pl = Polyline.Make( {pointList} )
shpFTab.SetValue( shpField, rec, pl )
elseif (type = “Polygon”) then
rec = shpFTab.AddRecord
shpFTab.SetValueNumber( idField, rec, 1 )
‘ Add first point to end of list to close the polygon…
startPoint = pointList.Get(0)
pointList.Add( startPoint )
pl = Polygon.Make( {pointList} )
shpFTab.SetValue( shpField, rec, pl )
end
end
av.ClearStatus
av.ClearMsg
shpFTab.Flush
MsgBox.Info( genRec.AsString++”records converted.” ,”Conversion Completed” )