MapInfo Pro

 View Only

MapInfo Monday: Creating Circular Sectors

  • 1.  MapInfo Monday: Creating Circular Sectors

    Employee
    Posted 06-12-2023 02:59
    Edited by Peter Møller 10-06-2023 01:20

    Happy #MapInfoMonday!

    In today's article, I want to highlight a hidden feature of the DrawTools add-in that you can download from the MapInfo Marketplace. DrawTools comes with several tools that allow you to manipulate your existing spatial objects and create new spatial objects.

    Unfortunately, not all of these tools come with an interface which makes them a bit harder to discover. Over time, we'll get interfaces added to these too.

    Today I want to highlight two similar tools: Create Circular Sector (Circular Sector on Wikipedia) and Create Annulus (Annulus on Wikipedia). When you load DrawTools you will have access to these two as spatial functions. Both of them create circular sectors using an input point, a direction, a radius, and a width. the function DTCreateAnnulus also takes an inner radius and will therefore return a sector from a doughnut.

    With DrawTools 3.x, DTCreateAnnulus has been renamed to DTCreateAnnulusSector as it creates a part of the Annulus and not the entire doughnut. This has been changed in the examples below.

    These types of objects are often used by telco companies to illustrate the coverage of cell towers. They can also be used to illustrate what area is at risk of being exposed to pollution or toxicity depending on the wind direction.

    You can use these functions to replace the spatial object in your table with a new spatial object through the Update statement.

    Let's check out the two statements and how you can use these.

    DTCreateCircularSector(oCenter, fDirection, fRadius, fAngleWidth, nResolution, nCalculationMethod)

    • oCenter: The point representing the center of the sector
    • fDirection: The direction of the sector in degrees (360) counterclockwise and with 0 being towards the East
    • fRadius: The radius of the sector in meters
    • fAngleWidth: The width of the sector in degrees (360), must be larger than 0 and smaller than 360
    • nResolution: The number of nodes to describe a 360 full circle, must be a value between 3 and 500
    • nCalculationMethod: Distance Calculation Method: Cartesian (1) for projected data or Spherical (2) for lat/long data.

    Below is an example showing how to use this function from the SQL Window. You can use fixed values for the parameters or you can refer to column names. In the example, there is a mixture of these two ways. The center point is read from the spatial object. The direction, radius, and width parameters are read from columns. Finally, the resolution and the calculation method are passed in as fixed values.

    Update CircularSectors
       Set OBJ = DTCreateCircularSector(OBJ, DIRECTION, RADIUS, WIDTH, 36, 1)

    In the SQL Window, the expression would look like this

    After running the statement, the result will look like this:

    And this is how it works for DTCreateAnnulus:

    DTCreateAnnulusSector(oCenter, fDirection, fRadiusInner, fRadiusOuter, fAngleWidth, nResolution, nCalculationMethod)
    • oCenter: The point representing the center of the annulus
    • fDirection: The direction of the annulus in degrees (360) counterclockwise and with 0 being towards the East
    • fRadiusInner: The inner radius of the annulus in meters
    • fRadiusOuter: The outer radius of the annulus in meters
    • fAngleWidth: The width of the annulus in degrees (360), must be larger than 0 and smaller than 360
    • nResolution: The number of nodes to describe a 360 full circle, must be a value between 3 and 500
    • nCalculationMethod: Distance Calculation Method: Cartesian (1) for projected data or Spherical (2) for lat/long data.
    Here is an example of an Update statement:
    Update CircularSectors
       Set OBJ = DTCreateAnnulusSector(OBJ, DIRECTION, 100, RADIUS, WIDTH, 36, 1)
    Note that the Inner Radius has been specified as a fixed value of 100. This value could also have been read from a column or it could have been set to an expression like RADIUS - 100 where the inner radius in this case would be 100 meters less than the outer radius.
    In the SQL Window it would look like this - note that the function has been renamed to DTCreateAnnulusSector from v3.x):
    And the resulting annulus objects would look like this:
    Cell towers mostly consist of multiple cells at each tower. To represent this, you would basically have as many points as you have cells and for each specify the direction the cell is pointing. If you do, you can get a result like this using the DTCreateCircularSector function described above.
    If you are using circular sectors or annulus polygons in your work, I'd love to hear from you. Please leave a comment below.



    ------------------------------
    Peter Horsbøll Møller
    Principal Presales Consultant | Distinguished Engineer
    Precisely | Trust in Data
    ------------------------------