HI Listers! My original question was: anybody out there willing to share a piece of code which generates a >rectangle (polygon-shape) from 4 points for each record written in a >dbase-table? as I have to do this task a lot of times I want to make a script which does >all of this automatically. Had to do this on my own. Thanks go to Bll Huber again, who pointed the right direction. I used the script sammple script GPS2Shape as a start. --------------------------------------------------------------------------------------- ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' '' Name: flurbildkat2poly '' '' '' '' Beschreibung: Wandelt aktuellen Flurbildkatalog in Polygonshape um (für Mapserver) '' '' '' '' Autor: Peter Brack '' '' '' '' Datum: 20.07.2001 '' '' '' '' Benötigt: Flurbildkat.dbf im ArcView-Projekt '' '' '' ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' 'Überprüfung: Möchte der User dies auch machen enforce = MsgBox.YesNoCancel("Möchten Sie die Flurkarten-Datenbank-Aktualisierung für TC.DACT WEBINFORM (Mapserver) starten?", "Mapserver Flurkarten-Datenbank-Aktualisierung", true) if (enforce <> TRUE) then exit end 'Flurbildkatalog als VTab definieren flurbildkatalogTable = av.FindDoc("flurbildkat.dbf") 'Falls kein Flurbildkatalog if (flurbildkatalogTable = Nil) then MsgBox.Info("Keine Datei namens 'flurbildkat.dbf' gefunden","") exit end flurbildkatalogVTab = flurbildkatalogTable.GetVtab ImageField = flurbildkatalogVTab.FindField("Image") 'nur für Recordcount des Flurbildkataloges for each rec in flurbildkatalogVTab reccount = rec +1 end MsgBox.Info(reccount.AssTring,"") defaultName = FileName.Make("fkpoly") shpname = defaultName FileDialog.Put( defaultName,"*.shp","Bitte Pfad angeben!" ) if (shpName = nil) then exit end shpName.SetExtension("shp") 'ShapeTyp angeben (Polygon) type = "Polygon" 'FTab für neues Polygonshape shpFTab = FTab.MakeNew(shpName, Polygon) 'Neue Felder definieren fields = List.Make fields.Add(Field.Make("IMAGE", #FIELD_VCHAR, 80, 0)) shpFTab.AddFields(fields) shpField = shpFTab.FindField("Shape") idField = shpFTab.FindField("IMAGE") if (type = "Polygon") then pointList = List.Make XMIN_Field = flurbildkatalogVTab.FindField("XMIN") YMIN_Field = flurbildkatalogVTab.FindField("YMIN") XMAX_Field = flurbildkatalogVTab.FindField("XMAX") YMAX_Field = flurbildkatalogVTab.FindField("YMAX") IMAGE_Field = flurbildkatalogVTab.FindField("IMAGE") for each rec in flurbildkatalogVTab XMIN = flurbildkatalogVTab.ReturnValue(XMIN_Field,rec) YMIN = flurbildkatalogVTab.ReturnValue(YMIN_Field,rec) XMAX = flurbildkatalogVTab.ReturnValue(XMAX_Field,rec) YMAX = flurbildkatalogVTab.ReturnValue(YMAX_Field,rec) IMAGE = flurbildkatalogVTab.ReturnValue(IMAGE_Field,rec) ' Punkte für Polys einlesen... thePointlu = point.make(XMIN,YMIN) thePointlo = point.make(XMIN,YMAX) thePointru = point.make(XMAX,YMIN) thePointro = point.make(XMAX,YMAX) pointList.Add( thePointlu) pointList.Add( thePointlo) pointList.Add( thePointro) pointList.Add( thePointru) rec = shpFTab.AddRecord shpFTab.SetValue( idField, rec, IMAGE ) ' 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 ) pointlist.Empty end ' If Line or Polygon we still need to create FTab... ' end av.ClearStatus av.ClearMsg shpFTab.Flush MsgBox.Info( "Flurkartenpolygon - Shape für TC.DACT WEBINFORM Mapserver erzeugt. Es wurden "++reccount.asString++" Flurkartendatensätze erkannt." ,"MapServerver-Aktualisiert komplett." ) ----------------------------------------------------------------------------------------------