Конвертишь img в польский формат, потом берешь ArcView и этот скрипт и получаешь shp
theView = av.GetActiveDoc
'STOP EDITING ALL THEMES
'
if (theView.GetEditableTheme <> nil) then
i = MsgBox.YesNoCancel("Save edits to "+theView.GetEditableTheme.GetName+"?","Stop Editing",true)
if (i = nil) then
return nil
end
if (theView.GetEditableTheme.StopEditing(i).Not) then
MsgBox.Info("Unable to Save Edits to "+theView.GetEditableTheme.GetName+", please use the Save Edits As option", "")
return nil
else
theView.SetEditableTheme(NIL)
end
end
'class = Point
'class = PolyLine
'class = Polygon
'CREATE 3 SHAPE FILES
'
'"c:\tmp\momap\".AsFileName.SetCWD
fnPoints = av.GetProject.MakeFileName("Points", "shp")
fnPoints = FileDialog.Put(fnPoints, "*.shp", "Points Theme")
if (fnPoints = nil) then
MsgBox.Error("Bad Points Theme File Name", "")
exit
end
fnLines = av.GetProject.MakeFileName("Lines", "shp")
fnLines = FileDialog.Put(fnLines, "*.shp", "Lines Theme")
if (fnLines = nil) then
MsgBox.Error("Bad Lines Theme File Name", "")
exit
end
fnPolygons = av.GetProject.MakeFileName("Polygons", "shp")
fnPolygons = FileDialog.Put(fnPolygons, "*.shp", "Polygons Theme")
if (fnPolygons = nil) then
MsgBox.Error("Bad Polygons Theme File Name", "")
exit
end
'CREATE 3 FTABS
'
ftabPoints = FTab.MakeNew(fnPoints, Point)
if (ftabPoints.HasError) then
if (ftabPoints.HasLockError) then
MsgBox.Error("Unable to acquire Write Lock for file " + fnPoints.GetBaseName, "")
else
MsgBox.Error("Unable to create " + fnPoints.GetBaseName, "")
end
exit
end
ftabLines = FTab.MakeNew(fnLines, PolyLine)
if (ftabLines.HasError) then
if (ftabLines.HasLockError) then
MsgBox.Error("Unable to acquire Write Lock for file " + fnLines.GetBaseName, "")
else
MsgBox.Error("Unable to create " + fnLines.GetBaseName, "")
end
exit
end
ftabPolygons = FTab.MakeNew(fnPolygons, Polygon)
if (ftabPolygons.HasError) then
if (ftabPolygons.HasLockError) then
MsgBox.Error("Unable to acquire Write Lock for file " + fnPolygons.GetBaseName, "")
else
MsgBox.Error("Unable to create " + fnPolygons.GetBaseName, "")
end
exit
end
'CREATE FIELDS in 3 FTABS
'
fldId = Field.Make("ID", #FIELD_DECIMAL, 8, 0)
fldRGN = Field.Make("RGN", #FIELD_DECIMAL, 2, 0)
fldType = Field.Make("Type", #FIELD_CHAR, 20, 0)
fldName = Field.Make("Name", #FIELD_CHAR, 40, 0)
'fldId.SetVisible(true)
'fldType.SetVisible(true)
'fldName.SetVisible(true)
lstFields = {fldId, fldRGN, fldType, fldName}
ftabPoints.AddFields(lstFields.DeepClone)
ftabLines.AddFields(lstFields.DeepClone)
ftabPolygons.AddFields(lstFields.DeepClone)
'ftabPoints.SetEditable(False)
thPoints = FTheme.Make(ftabPoints)
thLines = FTheme.Make(ftabLines)
thPolygons = FTheme.Make(ftabPolygons)
theView.AddTheme(thPoints)
theView.AddTheme(thLines)
theView.AddTheme(thPolygons)
thPoints.SetActive(true)
thLines.SetActive(true)
thPolygons.SetActive(true)
thPoints.SetVisible(true)
thLines.SetVisible(true)
thPolygons.SetVisible(true)
'theView.SetEditableTheme(thPoints)
'OPEN INPUT FILE
'
"c:\tmp\arcview\".AsFileName.SetCWD
fnInput = FileDialog.Show("*.txt", "Text file", "Input GPSMapper file")
if (fnInput = nil) then
MsgBox.Error("Bad Input File Name", "")
exit
end
fileInput = LineFile.Make(fnInput, #FILE_PERM_READ)
if (fileInput = nil) then
msgbox.Error("Input GPSMapper file wasn't found"+0x0A.AsChar+"File name:"+fnInput,"ERROR")
exit
end
'READ INPUT FILE
'
while (true)
strElt=fileInput.ReadElt
if (strElt = nil) then
break
end
'BLOCK BEGIN
'
if (strElt.Contains("[RGN")) then
sField = nil
sValue = nil
sShapeType = nil
sShapeName = nil
lstShapePoints = nil
iRGN = strElt.Middle(4,2).AsNumber
'READ FIELDS
'
while (true)
strElt = fileInput.ReadElt
'WARNING IF EOF REACHED BEFORE BLOCK CLOSED BY [END-RGN
'
if (strElt = nil) then
MsgBox.Info ("[END-RGN..] Block closing not found"
+0x0A.AsChar + "fileInput position:" + fileInput.GetPos.AsString, "Unexpected End of File")
break
end
'LEXICAL ANALYSIS
'
i = strElt.Indexof("=")
sField = strElt.Left(i)
sValue = strElt.Right(strElt.Count-i-1)
if (sField = "Type") then
sShapeType = sValue
elseif (sField = "Label") then
'MAKE NAME UPPERCASE STARTED AND CUT COMMENTS IN (...
i = sValue.Indexof("(")
if (i > 0) then
sShapeName = sValue.BasicProper("(").Left(i)
else
sShapeName = sValue.BasicProper("(")
end
'READ COORDINATES
'
elseif (sValue.Contains("(")) then
iID = sField.Middle(i-1,1).AsNumber
'GRAB DATA FROM MAXIMUM ZOOM ONLY
if (iID <> 0) then
break
end
sValue = sValue.Substitute("(","")
sValue = sValue.Substitute(")","")
' sValue = sValue.Trim
lstTmp = sValue.AsTokens(",")
'CONVERT THE LIST OF STRINGS TO LIST OF POINTS
'
lstShapePoints = List.Make
'DEBUG
'MsgBox.Info("lstTmp.Count="+lstTmp.Count.AsString+0x0A.AsChar+"lstTmp.Get(0)="+lstTmp.Get(0).AsString+0x0A.AsChar+"lstTmp.Get(1)="+lstTmp.Get(1).AsString,"DEBUG")
for each i in 0..(lstTmp.Count-1) by 2
lstShapePoints.Add(Point.Make(lstTmp.Get(i+1).AsNumber, lstTmp.Get(i).AsNumber))
end
'BLOCK END
'
elseif (strElt.Contains("[END-RGN")) then
'CHECK IF OBLIGATORY DATA OBTAINED
'
if (lstShapePoints = nil) then
if (Msgbox.YesNo ("Can't obtain coordinates"
+0x0A.AsChar + "fileInput position:" + fileInput.GetPos.AsString
+"Continue ?","Unexpected End of Block", true)) then
break
else
exit
end
end
'DRAW SHAPES
'
if (iRGN = 10) then
break
elseif (iRGN = 20) then
if (sShapeName = nil) then
break
end
if (sShapeType = "0x02") then
sShapeType = "MajorCity"
elseif (sShapeType = "0x03") then
sShapeType = "City"
elseif (sShapeType = "0x04") then
sShapeType = "MinorCity"
elseif (sShapeType = "0x08") then
sShapeType = "Town"
elseif (sShapeType = "0x0a") then
sShapeType = "SmallTown"
end
ftabTmp = ftabPoints
shapeTmp = lstShapePoints.Get(0)
elseif (iRGN = 40) then
if (sShapeType = "0x01") then
sShapeType = "FreeWay"
elseif (sShapeType = "0x02") then
sShapeType = "HighWay"
elseif (sShapeType = "0x03") then
sShapeType = "Road3"
elseif (sShapeType = "0x04") then
sShapeType = "Road4"
elseif (sShapeType = "0x05") then
sShapeType = "Road5"
elseif (sShapeType = "0x06") then
sShapeType = "Road6"
elseif (sShapeType = "0x14") then
sShapeType = "RailRoad"
elseif (sShapeType = "0x18") then
sShapeType = "WaterLine"
elseif (sShapeType = "0x1c") then
sShapeType = "Border"
elseif (sShapeType = "0x1f") then
sShapeType = "River"
end
ftabTmp = ftabLines
shapeTmp = PolyLine.Make({lstShapePoints})
elseif (iRGN = 80) then
if (sShapeType = "0x01") then
sShapeType = "Building"
elseif (sShapeType = "0x3c") then
sShapeType = "Water"
en