ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / WLanguage / Managing databases / HFSQL / Spatial data management
  • Properties specific to PolygonGeo variables
  • Functions that use the PolygonGeo type
WINDEV
WindowsLinuxJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac Catalyst
Others
Stored procedures
The PolygonGeo type is used to define all the advanced characteristics of a geographic polygon. You can define and change the characteristics of this geographic polygon using different WLanguage properties.
Characteristics of a geographic polygon:
A geographic polygon is a polygon mapped on an spherical representation of the earth. A geographic polygon consists of:
  • a boundary, which is a simple, closed geographic linestring.
  • one or more optional holes, which are also simple, closed geographic linestrings.
    Holes can't be nested, nor can they intersect with each other or with boundaries.
To be considered valid, a polygon must meet certain criteria:
  • Its boundary is a simple and closed linestring, i.e., it does not intersect itself and its last and first points are equal.
  • The points of the boundary must be ordered clockwise.
  • Holes must be oriented counterclockwise.
  • Holes are also simple and closed.
  • The holes of a polygon cannot cross. They can intersect, but cannot have points of their interiors in common. Therefore, intersections (if any) occur at a tangent point. This also applies to intersections between the boundary and holes of a polygon.
  • A polygon cannot have spikes or lines without an interior.
  • The interior of a polygon is a connected set of points. It should always be possible to go from one point of the interior of the polygon to another without crossing the boundary. This means that a hole should never split the interior of a polygon into more parts.
Remark: For more details on the declaration of this type of variable and the use of WLanguage properties, see Declaring a variable.
Example
// Declaration of a linestring to define the exterior ring of the polygon
myGeoLinestring is LinestringGeo

// Build the linestring that represents the exterior ring of the polygon: 4 points
myGeoLinestring.AddPoint(2.681548, 43.802043)
myGeoLinestring.AddPoint(2.816297, 43.725179)
myGeoLinestring.AddPoint(2.842733, 43.817899)
myGeoLinestring.AddPoint(2.644979, 43.837466)
// Close the polygon, adding the first point at the end of the boundary
myGeoLinestring.AddPoint(2.681548, 43.802043)

// Display the exterior ring
Trace("myGeoLinestring: " + GeometrySerializeWKT(myGeoLinestring))

// Polygon declaration 
// Assign exterior ring built previously
myGeoPolygon is PolygonGeo
myGeoPolygon.Outline = myGeoPolygon

// Empty the linestring used to build the exterior ring
myGeoLinestring.Point.DeleteAll()
// Use the linestring to build a hole (triangle in this case)
myGeoLinestring.AddPoint(2.755159351, 43.793494741)
myGeoLinestring.AddPoint(2.763978715, 43.820568136)
myGeoLinestring.AddPoint(2.783053152, 43.769702969)
// Close the hole by adding the first point at the end.
myGeoLinestring.AddPoint(2.755159351, 43.793494741)

// Add hole in polygon.
myGeoPolygon.Hole.Add(myGeoLinestring)

// Display
Trace("myGeoPolygon: " + GeometrySerializeWKT(myGeoPolygon))
Trace("GeometryIsValid: " + GeometryIsValid(myGeoPolygon))
Properties

Properties specific to PolygonGeo variables

The following properties can be used to handle a geographic polygon:
Property nameType usedEffect
OutlineLinestringGeoExterior ring of the polygon. This outline is a simple, closed linestring defined in geographic coordinates.
HoleArray of LinestringGeoSimple, closed linestrings (defined in geographic coordinates) inside the exterior ring of the polygon.
TypeInteger constantType of the current geometry. For a geographic polygon, corresponds to the gtPolygonGeo constant.
Remark: Until version 2024 Update 2, this constant was named stPolygonGeo.
This property is available in read-only.
Remarks

Functions that use the PolygonGeo type

The following functions use PolygonGeo variables:
GeometryAreaCalculates the area of a given geometry.
GeometryContainDetermines if geometry A contains geometry B.
GeometryConvexHullCalculates the convex hull of the specified geometry.
GeometryCorrectReturns a corrected version of the specified geometry.
GeometryCoverDetermines if geometry A covers geometry B.
GeometryCoveredByDetermines if every point of geometry A lies inside or on the boundary of geometry B.
GeometryCrossCompares two geometries and determines if their intersection spatially crosses.
GeometryDifferenceReturns a geometry representing the difference between two geometries.
GeometryDisjointDetermines whether two geometries are disjoint, i.e. whether their intersection is empty.
GeometryDistanceCalculates the distance between two geometries.
GeometryEqualDetermines whether two geometries are spatially equal, i.e. whether the first geometry is included in the second, and vice versa.
GeometryIntersectChecks whether two geometries have a non-empty intersection.
GeometryIntersectionReturns a geometry representing the intersection of two geometries.
GeometryIsValidChecks whether the specified geometry is valid according to the OGC rules.
GeometryLengthCalculates the length of a given geometry.
GeometryOverlapDetermines whether two geometries overlap.
GeometryPerimeterCalculates the perimeter of a given geometry (polygon or multipolygon).
GeometrySerializeDSVSerializes a geometry using the specified DSV format.
GeometrySerializeWKTSerializes a geometry using the Well-Known Text (WKT) format.
GeometrySymmetricDifferenceCalculates the symmetric difference between two geometries.
GeometryTouchDetermines whether two geometries touch.
GeometryUnionReturns a geometry corresponding to the union of two geometries.
GeometryWithinDetermines whether geometry A is completely within geometry B (i.e., geometry B completely contains geometry A).
LinestringGeoAddPointAdds a new point to a geographic linestring.
Minimum version required
  • Version 2024
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 05/28/2024

Send a report | Local help