Var TheSHPFile : Shapefile; ptoIndex1,ptoIndex2, ptoIndex3, ptoIndex4 : Integer; MyTalhao : Shape; MyPoint0 : MapWinGIS_TLB.Point; MyPoint1 : MapWinGIS_TLB.Point; MyPoint2 : MapWinGIS_TLB.Point; MyPoint3 : MapWinGIS_TLB.Point; MyPoint4 : MapWinGIS_TLB.Point; hnd: longint; VAR Xmin,Ymin,Xmax,Ymax : double; Begin DeleteFile(ExtractFileDir(Application.ExeName) 'Mapa.shp'); DeleteFile(ExtractFileDir(Application.ExeName) 'Mapa.dbf'); DeleteFile(ExtractFileDir(Application.ExeName) 'Mapa.shx'); Try TheSHPFile := CoShapefile.Create(); If TheSHPFile.CreateNew('mapa.shp', SHP_POLYGON) Then begin MyTalhao := coShape.create(); If MyTalhao.Create(SHP_POLYGON) Then begin MyPoint0 := coPoint.Create; MyPoint1 := coPoint.Create; MyPoint2 := coPoint.Create; MyPoint3 := coPoint.Create; MyPoint4 := coPoint.Create; map1.ProjToPixel(22.0087, -47.5334, xMin, yMin); map1.ProjToPixel(22.0094, -47.5341, xMax, yMin); MyPoint0.x := xMin; MyPoint1.x := xMax; MyPoint2.x := xMax; MyPoint3.x := xMin; MyPoint4.x := xMin; MyPoint0.y := yMax; MyPoint1.y := yMax; MyPoint2.y := yMin; MyPoint3.y := yMin; MyPoint4.y := yMax; ptoIndex1 := 0; MyTalhao.InsertPoint(MyPoint0, ptoIndex1); MyTalhao.InsertPoint(MyPoint1, ptoIndex1); MyTalhao.InsertPoint(MyPoint2, ptoIndex1); MyTalhao.InsertPoint(MyPoint3, ptoIndex1); MyTalhao.InsertPoint(MyPoint4, ptoIndex1); TheSHPFile.EditInsertShape(MyTalhao, ptoIndex1); TheSHPFile.StopEditingShapes(true,true,nil); TheSHPFile.SaveAs('mapa.shp', Nil); hnd := Map1.AddLayer(TheSHPFile, true); Map1.SendMouseMove:=true; Map1.SendMouseUp:=true; Map1.SendMouseDown:=true; Map1.ZoomToMaxExtents; Map1.Refresh; Map1.Update; End Else showmessage('Problemas ao criar o arquivo SHP'); end except showmessage('Err.Description, MsgBoxStyle.Critical, "Atenção'); TheSHPFile.Close() ; TheSHPFile := Nil; MyTalhao := Nil; MyPoint0 := Nil; MyPoint1 := Nil; MyPoint2 := Nil; MyPoint3 := Nil; MyPoint4 := Nil; End procedure TForm1.Map1MouseMove(Sender: TObject; Button, Shift: Smallint; x, y: Integer); VAR XDeg,YDeg : double; begin map1.PixelToProj( x, y, XDeg, XDeg); StatusBar1.Panels[0].Text := 'Lat=' FloatTostrF(XDeg,fffixed,4,2) ' º'; StatusBar1.Panels[1].Text := 'Long=' FloatTostrF(XDeg,fffixed,4,2) ' º'; end;