ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / WLanguage / Managing databases / HFSQL / Spatial data management
  • Properties specific to Geometry variables
  • Functions that use the Geometry type
WINDEV
WindowsLinuxJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac Catalyst
Others
Stored procedures
The Geometry type can be used to store any type of geometry: point, polygon, etc.
This means that any WLanguage function that can return a point or polygon depending on its parameters, can have a variable of type Geometry as return value.
Once declared, Geometry variables are empty until a value is assigned to them.
Note: For more details on the declaration of this type of variable and the use of WLanguage properties, see Declaring a variable.

Example
// Example 1: Get a point without verification
f is Geometry()
// Get geometry
f = GetPoint() // GetPoint is a procedure used to get a point
p is Point2D = f
// Example 2: Check type of geometry to make sure a point is retrieved before attempting conversion
f is Geometry 
// Get geometry ...
// Check geometry
IF f.Type = gtPoint2D THEN
   my2DPoint is Point2D
   my2DPoint = f
   //...
END
// Example 3: The type of a geometry can be changed
point is Point2D
linestring is Linestring2D
f is Geometry // Geometry is empty and can take any type of geometry
f = point // Geometry now contains a Point2D object.
f = linestring // Geometry now contains a Linestring2D object.
// Example 4: Get a geographic polygon without verification
// No need to declare an intermediate geometry 
// Directly convert the result of a function
f = GetGeometry() // GetGeometry is a procedure used to get a geometry
IF f.Type = gtPolygonGeo THEN
   polygon is PolygonGeo
   polygon = f
   // ...
END
// Example 5: If the type of geometry retrieved is unknown,
// different code can be executed according to the type of geometry
UnknownGeometry is Geometry
UnknownGeometry = GetUnknownGeometry() 
// GetUnknownGeometry is a procedure used to get a geometry
SWITCH UnknownGeometry.Type 
	CASE gtPoint2D:
	       // ...
	CASE gtLinestring2D:
	       // ...
	CASE gtPolygon2D:
	       // ...
	OTHER CASE:
	       // ...
END
Properties

Properties specific to Geometry variables

The following properties can be used to manipulate a variable of type Geometry:
Property nameType usedEffect
TypeInteger constantType of the current geometry:
  • gtInvalid: Invalid type.
    Note: Until version 2024 Update 2, this constant was named stInvalid.
  • gtGeometryCollection: Collection of geometries.
    Note: Until version 2024 Update 2, this constant was named stShapeCollection.
  • gtMultiPoint2D: Collection of 2D points.
    Note: Until version 2024 Update 2, this constant was named stMultiPoint2D.
  • gtMultiPointGeo: Collection of geographic points.
    Note: Until version 2024 Update 2, this constant was named stMultiPointGeo.
  • gtMultiPolygon2D: Collection of 2D polygons.
    Note: Until version 2024 Update 2, this constant was named stMultiPolygon2D.
  • gtMultiPolygonGeo: Collection of geographic polygons.
    Note: Until version 2024 Update 2, this constant was named stMultiPolygonGeo.
  • gtMultiLinestring2D: Collection of 2D multilinestrings.
    Note: Until version 2024 Update 2, this constant was named stMultiLinestring2D.
  • gtMultiLinestringGeo: Collection of geographic linestrings.
    Note: Until version 2024 Update 2, this constant was named stMultiLinestringGeo.
  • tgPoint2D: 2-dimensional point, defined by X and Y coordinates on a Cartesian plane.
    Note: Until version 2024 Update 2, this constant was named stPoint2D.
  • gtPointGeo: Geographic point, defined by latitude and longitude.
    Note: Until version 2024 Update 2, this constant was named stPointGeo.
  • tgPolygone2D: Collection of straight consecutive segments that form a polygon.
    Note: Until version 2024 Update 2, this constant was named stPolygon2D.
  • gtPolygonGeo: Collection of consecutive curved segments that form a polygon (the curvature of these segments respects the Earth's curvature).
    Note: Until version 2024 Update 2, this constant was named stPolygonGeo.
  • gtLinestring2D: Set of consecutive straight segments.
    Note: Until version 2024 Update 2, this constant was named stLinestring2D.
  • gtLinestringGeo: Collection of consecutive curved segments (the curvature of these segments respects the Earth's curvature).
    Note: Until version 2024 Update 2, this constant was named stLinestringGeo.
This property is available in read-only.
Remarks

Functions that use the Geometry type

The following functions use Geometry 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.
GeometryDeserializeWKT2DBuilds a 2D geometry from a Well-Known Text (WKT) representation.
GeometryDeserializeWKTGeoBuilds a geometry in geographic coordinates from a Well-Known Text (WKT) representation.
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).
Minimum version required
  • Version 2024
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 09/19/2024

Send a report | Local help