Example Polygon Regions

GeoJSON complexity can impact on server calculation time and client display time. We recommend that regions are as simple as possible to aid performance.

To understand how to create a polygon region in Geo SCADA Expert you need to understand the GeoJSON format for encoding geographic data structures. A GeoJSON object can represent a geometry, a feature, or a collection of features, for example, a Point, LineString, Polygon, MultiPoint, MultiLineString, MultiPolygon, and GeometryCollection.

In Geo SCADA Expert we are primarily concerned with the Polygon object in the context of regions (for information about other types of GeoJSON objects refer to the GeoJSON Specification. A polygon region consists of a set of coordinates, which are defined by real world latitude and longitude values.

The basic element of a polygon is a point (position), to make a polygon you need at least 3 points to enclose an area.

Coordinates in GeoJSON are formatted in simple decimal format, you can not use the degrees, minutes, seconds notation.

Latitude 52° 23' 4.1" Longitude 1° 33' 33.2" West

is expressed as:

52.38446667, -1.5592217

where - is west and + is east.

Position

A position is an array of coordinates and is the smallest unit that we can really consider ‘a place’ since it can represent a point on earth. GeoJSON describes an order for coordinates: they should go, in order:

[longitude, latitude, elevation]

We do not require elevation for the definition of regions in Geo SCADA Expert, so this can be ignored.

Historically, the order of world coordinates is usually “latitude, longitude” but, data formats usually use the longitude, latitude order as they match the X, Y order of math.

Display Properties

You can include polygon regions on maps. As such, consider including settings to specify properties such as the region's display name, fill opacity, and stroke (line) width.

Due to the nature of projecting the globe onto a 2D map, the lines drawn to represent a Polygon Region are an approximation. The closer to the pole and the longer any given line (that is not exactly orientated north-south), the greater the degree of inaccuracy.

 

The following example comprises various properties that define a Polygon Region's appearance and name on a map.

"properties": {

"stroke": "#9148db",

"stroke-width": 20,

"stroke-opacity": 0.5,

"fill": "#57dba2",

"fill-opacity": 0.25

"name": "Region Display Name"

},

  • "stroke" is the color of the surrounding line of the region, in hex format.

  • "stroke-width" is the width of the surrounding line. This should be a number.

  • "stroke-opacity" is the level of opacity (transparency) of the surrounding line. This is a number from 0 to 1.

  • "fill" is the color of the region's area, in hex format.

  • "fill-opacity" is the level of opacity (transparency) of the region's area. This is a number from 0 to 1.

  • "name" is the name that is displayed for the region on a map's Layer menu. If you omit this property, the Full Name of the Region database item (which includes its path in the database) is shown instead.

Geometry

Geometries are shapes. All simple geometries in GeoJSON consist of a type and a collection of coordinates.

Polygons

Polygons are complex GeoJSON geometries, as they have area, so they have insides and outsides.

 

The following is an example of a simple three sided polygon. There are four position coordinates, the first and last coordinates must be the same to form a closed polygon.

{

"type": "Polygon",

"coordinates": [

[

[0, 0], [10, 10], [10, 0], [0, 0]

]

]

}

This code is sufficient to create a basic region within Geo SCADA Expert. The coordinates shown are list on one line, for larger polygon it is useful to list each set of coordinates on a separate line.

[

[0, 0],

[10, 10],

[10, 0],

[0, 0]

]

 

This example shows a clockwise sequence creating a six sided polygon. All the following examples of code assume that a polygon is drawn in a clockwise direction.

The definition for the polygon illustrated is shown below, if you reversed the sequence of coordinates the polygon would be created in the counter-clockwise direction:

Polygons within Polygons

It is possible to create polygons within polygons (regions within regions), in situations where you want to subdivide an region and be able to work with the whole region as well.

Polygons with holes

Polygons are not just enclosed areas, but can have cut-outs or holes. To understand how to construct polygons with cut-outs we need to introduce a new term: the LinearRing. LinearRings are a set of positions that define a line that encloses a space (a polygon), however, you can have an exterior LinearRing and none, one or more interior LinearRing. For Polygons with multiple rings:

We recommend that exterior rings are always defined in the clockwise direction and interior rings are defined in the counter-clockwise direction.

Further Information

For additional information on how to work with GeoJSON refer to the GeoJSON Specification, also the website geojson.io can be used as an aid in creating polygons.


Disclaimer

Geo SCADA Expert 2022