Upload
makgops432
View
16
Download
0
Embed Size (px)
DESCRIPTION
MapBasic Sector Create approach
Citation preview
Creating Site Sectors using MapBasicI have a table with these column: Sitename, Lon, Lat, Azi, Beam, Dist.
Include "MapBasic.def"
Dim oSite, oSite2, oDirection, oRotateAtPoint1, oRotateAtPoint2, oSector As Object, Beam1, HalfBeam1, Bearing1, Dist1, Lon1, Lat1 As Float, Trash As String
Trash=ApplicationDirectory$()+"Sectors.tab"Create Table Sectors (id Char(10)) File Trash TYPE NATIVE Charset "WindowsLatin1"Create Map For Sectors CoordSys Earth Projection 1, 0Set CoordSys Table Sectors
Map From SectorsSet Map Layer 1 Editable On
Fetch First From TempDo While Not EOT (Temp) '---Cell 1 ------ Lon1 = Temp.Longitude Lat1 = Temp.Latitude Bearing1 = Temp.Azimuth
Beam1 = 60 HalfBeam1 = Beam1 / 2 Dist1 = 250
oSite = CreatePoint(Lon1,Lat1) oSite2 = OffSet(oSite, Bearing1, Dist1, "m")
oDirection = CreateLine(Lon1, Lat1, CentroidX(oSite2), CentroidY(oSite2)) oRotateAtPoint1 = RotateAtPoint(oDirection, HalfBeam1, oSite) oRotateAtPoint2 = RotateAtPoint(oDirection, (360 - HalfBeam1), oSite)
Create Region Into Variable oSector 1 5 (Lon1, Lat1) (ObjectGeography(oRotateAtPoint1, OBJ_GEO_LINEENDX), ObjectGeography(oRotateAtPoint1, OBJ_GEO_LINEENDY)) (CentroidX(oSite2), CentroidY(oSite2)) (ObjectGeography(oRotateAtPoint2, OBJ_GEO_LINEENDX), ObjectGeography(oRotateAtPoint2, OBJ_GEO_LINEENDY)) (Lon1, Lat1)
Insert Into Sectors (Obj) Values (oSector)
Fetch Next From TempLoop
Set Map Zoom Entire Layer Sectors