# Pie sector features communicate multivariate data

By Kenneth Field, Esri Research Cartographer

In many industries, simple geometric shapes such as squares and circles do not adequately represent objects.  Some phenomena are just more complicated and require alternative approaches to represent them meaningfully.  We had a question on Ask a Cartographer recently about creating pie segment shapes as features to support a requirement in the telecommunications industry.  The geometry of the feature needed to represent the signal emitted from a cellphone mast.  This sort of geometry cannot be built out of the box but by using Python we were able to build a custom Geoprocessing tool that could automate the process and build the features required.  In this blog entry we explain why a pie segment better represents a cellphone signal, how they were constructed and what data are needed to run the tool.  We also share the Geoprocessing tool so that others with this requirement can make similar maps.

A cellphone signal is transmitted from a mast (a central point); in a particular direction (orientation); across a defined area (spread); and for a specific distance (extent).  Figure 1 illustrates the principles involved and shows how the segment can be described by its bearing (to give orientation), angle (to give spread) and radius (to give extent of the signal’s reach).

Figure 1. Principles of pie sector feature geometry

The pie sector is part of an ellipse which has an x, y origin at its centre.  The center points are defined by longitude and latitude values in a geographic coordinate system. Although longitude and latitude locate exact positions on the surface of the globe, they do not provide uniform units of measurement for length and distance because the earth is not a perfect sphere.  Only along the equator does the distance represented by one degree of longitude approximate the distance represented by one degree of latitude.

Instead of basing calculations on a spherical earth shape, we can use geodesic measurements to account for the inherent distortion of projected space on the non-spherical shape. Geodesic features are particularly useful when performing analysis for features that are more dispersed and span large distances (where distortions increase in orders of magnitude). This also explains why, in figure 1, we have an ellipse rather than a perfect circle since it is a geodesic buffer about an x, y origin with a uniform radius length throughout.

The direction of the centerline of the pie sector (blue dashed line in figure 1) is defined by the bearing (or azimuth) from North and is measured in degrees. The centerline is also the radius of the circle from which the pie sector forms a part. The radius determines the distance from the longitude, latitude (x, y) origin to the outer edge of the arc to model the extent of the cellphone signal’s reach. Two radii will form the straight edges of the pie sector (solid blue lines in figure 1). Because the cellphone transmitter is directional, the segment has a sector angle of opening that establishes the spread of the signal and so, the position of the two radii that form the extent of the pie sector. Figure 2 illustrates how this data might appear in a table as a set of input data that defines the features.

Figure 2. Tabulated data for cellphone pie sector features

Since ArcGIS doesn’t contain a Geoprocessing tool that can build these sort of features, the starting point to building a new tool is exploring what already exists and then determining if the current tools contains functionality that can be used as a basis for a new tool. There are several tools that work with geodesic measurement e.g. Construct GeodeticBearing Distance To LineTable To Ellipse, and XY To Line.

Using the functions that already exist in these tools and the tabulated data that define the cellphone signals it is possible to construct geodesic buffers about an x, y origin, calculate the bearing of the sector, define the points on the buffer line that mark the end points of the two enclosing radii, build the line features to connect the buffer edge to the origin, build polygon features and then select the pie sector.

The tool is scripted in Python to automate the various stages in the process of feature geometry creation.  The tool is built for ArcGIS v10.0 Service Pack 2 and will not work on previous versions of ArcGIS.  It functions only at the ArcInfo license level since it uses the XY To Line tool that is only available at that level.

To run the tool, first download the zip file from the Models and Scripts Resources page on Mapping Center and then save it in a suitable location on your hard drive.  This does not have to be a particular directory but should be somewhere you can access and which is likely to remain.  In a new ArcMap Document, open ArcCatalog and then navigate to the Sector toolbox and open it to see the Geodesic Sector tool (figure 3). Whilst this blog entry is not designed to step through the code for the tool, the tool itself contains full documentation and comments to enable users to follow its operation (and modify if necessary).  If you wish, you can explore the code structure and see how it calculates and creates the pie sectors by right clicking the tool in Catalog and selecting Edit.

Figure 3. Opening the Sector Analysis tool in ArcCatalog

Before running the tool, check that you are not running background processing. The tool requires processing to be run in the foreground which can be controlled by clicking Geoprocessing > Geoprocessing Options on the Standard toolbar.

To run the Geodesic Sector tool, double click the tool to launch a dialog box where you input the model parameters (figure 4). The input file needs to be in dBase format (.dbf). The output will be a polygon feature class so be sure to provide a suitable name in a file geodatabase. The remaining parameters can be completed by selecting from dropdowns that reflect the field names in your attribute table.

Figure 4. Populating the geodesic pie sector tool parameters

Figure 5 illustrates the different stages of the construction of the pie sectors that goes on behind the scenes in ArcGIS. The data created as part of the interim steps are deleted from the geodatabase once the tool has finished running but they can be retained by removing the relevant commented out section in the code if required. Instructions for this are included in the code itself.

Figure 5. Stages in constructing geodesic pie sectors

Figure 5a shows the construction of the geodesic buffers about the longitude and latitude using the Table to Ellipse functions. The next step creates radii lines that delineate each sector (shown here in blue) and also the centre line (shown here in red) using Bearing Distance to Linefunctions (figure 5b). The geodesic buffers and the sector lines are then merged into one polygon using Feature to Polygon functions (figure 5c). Finally, only those polygons that are intersected by the previously created center lines are selected and then exported as the final pie sector feature class (figure 5d). Temporary files are deleted and the pie sector feature class is added to the Table of Contents. Figure 6 illustrates the results of running the tool on our test data to create seven pie sectors of varying dimensions.

Figure 6. Pie sector polygon features

The geodesic pie sector tool developed to create the pie sector features only creates the basic two-dimensional shape of the direction and spread of a cellphone signal. It’s sufficient for many mapping tasks.  To model the physics involved in the way in which the signals move through three dimensional space would require further modelling to show the z dimension and signal modulation. However, the pie sector tool gives you a starting point from which to model the more complex structure of the cellphone signal.

Thanks to Linda Beale, Geoprocessing Product Engineer, for building the model and developing the tool.

Postscript: In testing this tool it became apparent that some computers stored their Python libraries in alternate locations. In order for this (and other Python scripted tools) to work, it is important that you set a PYTHONPATH Environment variable in your Computer System settings. To check your Environment variables, right-click on My Computer and choose Properties, and then go to Advanced System Settings, select the Advanced tab and then click the Environment Variables button (at the bottom right). Does the PYTHONPATH Environment variable exist?

If not, click New and create a PYTHONPATH environment variable and point it to c:python26ArcGIS10.0lib. Click OK twice, close the remaining dialog boxes and then reboot your machine and you should be all set.

This entry was posted in Mapping, Telecommunications and tagged , , , , , , . Bookmark the permalink.

1. kmayall says:

Thank you for this. Previously I had made use of a script here:

http://arcscripts.esri.com/details.asp?dbid=16089

That script uses a different method, building the polygon vertex by vertex.

With the area and scale shown in Figure 6 (i.e., not a large area of dispersed masts), and if your data are all in a mercator projection, could you not legitimately use a conventional buffer tool instead of the geodesic buffer?

2. kenfield says:

You could use that approach but do be aware that distortions in area will exist given the use of a Mercator projection. Hence, the use of a geodesic buffer.

3. will_davis44 says:

First off, I really appreciate this tool you guys created, helped me out a lot! It did what I needed it to do, but I did have to go a round about way to get there. Just a heads up if someone hasn’t reported it yet- If you have pie segments that will overlap each other, the pie pieces will fail to draw. I had a couple pieces overlap and noticed that I couldn’t get an output unless I did them individually.

Again, thanks guys!

• Kenneth Field says:

Glad it worked for you. Thanks for the feedback which we can use to refine the tool.

4. glennk says:

According to what my toolbox is telling me, all of the tools this script makes use of are available to me, yet I am using ArcEditor (ArcGIS Standard??). As a matter of fact, it seems that this script can be used by ArcView/Basic. Can anyone confirm? Also, any luck on getting this to work with overlapping sectors?

• Kenneth Field says:

The updated tool (that deals with overlapping sectors) is currently being worked on…can’t promise a precise date when it will be posted but it will be sooner rather than later.

5. glennk says:

Well crud. Looks like you do need ArcInfo to use this, with the Features to Polygon tool being the offending particpant. Anyway to get around this for us ArcView/ArcEditor users? Upgrading to Info is not an option.

6. flynnpc says:

Hello. I was wondering if anyone ever solved the overlapping sector issue? I need to use the tool to show potential sectors of cell phone towers. A single tower may have multiple bearings associated with it and I need to be able to account for that. I would appreciate any help you can offer. Thanks.

7. skaplan3 says:

hello,
did anyone find a solution to the overlap problem?
thank you
shai

8. axionman says:

i am trying to locate the zip file but it seems impossible for the url keeps sending me on the same page.
any help will be greatly appreciated.

9. gdurkee says:

Hi: did the tool move or been superseded? I can’t find it at the posted link.
Thanks,
George

10. Kenneth Field says:

We haven’t experienced the issue you raise. The tool does work on multiple features. Feel free to contact me offline if you can let us use some of your data to further test the tool and see if we can replicate the issue.

11. megrosebrough says:

Is there a new version that allows the segments to draw when they overlap? I would love a copy of it. I am mapping cell phone tower segments in an urban area for a case with 12,000 records and many of them overlap so they are not drawn.