# How can i create sectors for telecom towers

friends i am seeking advice from the GIS community

I work in the Mobile networks industry and i took up a task to create a plugin for QGIS using `c++/python` that does the following:

• step 1: Create points corresponding to each mobile tower based on Lat/Long of each tower( this part i have accomplished )

• step 2: Further: sectorise: each of these towers would have antennas oriented at different azimuths. so i need to create a symbol for each antenna direction (would in the end look like a flower petal in a flower or inward pointed triangles)

• step 3: When i click on any sector, all nearby sectors facing the sector should be highlighted in some way( so i can find the neighbors)

What i have to start with is a big excel file containing the sector name , lattitude, longitude, antenna orientation , etc.

Does anyone have any opinion ?

-

Step 2 Not familiar enough with QGIS, but what I have done with sectors in arcgis (for cell towers and tornado sirens) is created polygons to reflect their coverage. Decide the radius you want to reflect a specific power and an angle you want to represent the sweep. Draw a line from the center at angle azimuth - (sweep/2) for length = radius. Next, draw a tangent curve from that point with the sweep angle and azimuth you want, then return to your center point. And that gives you the polygon sector.

Step 3 A bit more complicated here. Assuming you have a radius to define "nearby", you buffer a selection around your tower point using that radius (if you want sectors that mutually face each other, instead of a buffer, use a sector polygon out to your selection radius constructed like in step 2). Iterate through the towers selected. For each tower, use arctangent to get the bearing to it. e.g.

``````bearing = arctan((y1-y0)/(x1-x0)
``````

Where x0,y0 is the location of your original tower and x1,y1 is the location of a selected tower. Once you have the bearing, compare that to the azimuth of the sectors on the other tower. First, flip the bearing the opposite direction. e.g. if the angle is less than 180, add 180. If it is greater than 180, subtract 180. Then, if the flipped bearing lies between the sweep values for the sector on the selected tower, you have a match.

For example, if you bearing is 225 (due southwest), then the flipped bearing is 45 (due northwest). Assuming you have sectors facing 60, 180, and 300, with a sweep of 120 degrees. The first sector covers 0 to 120, the second covers 120 to 240, and the third covers 240 to 0. Only the first sector has the flipped bearing, 45, inside of it, so that is the sector that faces your sector.

-
Once you have completed step 2, would it not suffice in step 3 simply to (1) find all towers within the desired distance of a selected sector and (2) among those towers, retain those whose sector polygons intersect the selected sector polygon? – whuber May 16 '12 at 21:38
He wanted the sectors -facing- the selected sector. And his definition for "nearby" might be greater than or less than the radius of the sector – blord-castillo May 17 '12 at 10:54
Allow me to clarify, then. When setting things up, create sector polygons extending out to the largest anticipated search radius. In step (1) you don't necessarily use the radius of the polygonal representations of the sectors: you use any desired query distance. In step (2), intersection of sectors guarantees that they are facing. – whuber May 17 '12 at 14:02
@whuber: I will add a little clarity: I will attach a sample picture of what i need!(Posted above)The red lines are irrelevant to my present project though these will come in at a later stage. Take for example that single "flower" with all lines drawn towards it.The industry code word for each petal is sector.It represents a tower mounted with 3 antennas(sectors) at 0, 120, 260 degrees. My first hurdle is how i can draw these polygons of this shape from an excel/csv containing sector name, sector azimuth, sector latitude & sector longitude. – Bavin May 17 '12 at 15:11
Also i would need to repeat the drawing process to roughly 20000 sectors per mobile services provider. i need to understand the PyQGIS way of drawing polygons and accessing the attributes table to understand the azimuth and orient the polygon according to what "blord-castillo" did in his arcGis program – Bavin May 17 '12 at 15:15