ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

New WINDEV, WEBDEV and WINDEV Mobile 2024 feature!
Help / WLanguage / Managing databases / HFSQL / 
  • Accessing spatial data: using spatial indexes
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
Others
Stored procedures
Determines whether geometry A (2D polygon) is completely within geometry B (i.e., geometry B completely contains geometry A).
In this case:
  • No point of geometry A lies outside geometry B: all points of geometry A are either in the interior or on the boundary of geometry B.
  • The interiors of B and A have at least one point in common.
Example
o2DPolygon_1 is Polygon2D
o2DPolygon_1.Outline.AddPoint(-4.00, -4.00)
o2DPolygon_1.Outline.AddPoint(-4.00, 2.00)
o2DPolygon_1.Outline.AddPoint(5.00, 2.00)
o2DPolygon_1.Outline.AddPoint(5.00, -4.00)
// Add last point (same as first)
o2DPolygon_1.Outline.AddPoint(-4.00, -4.00)

o2DPolygon_2 is Polygon2D
o2DPolygon_2.Outline.AddPoint(-1.00, -2.00)
o2DPolygon_2.Outline.AddPoint(2.00, 0.00)
o2DPolygon_2.Outline.AddPoint(2.00, -2.00)
o2DPolygon_2.Outline.AddPoint(-1.00, -2.00) // Close

let p2_in_p1 = o2DPolygon_1.Contain(o2DPolygon_2) // Returns "True"
o2DPolygon_2.Within(o2DPolygon_1) // Returns "True"
Syntax
<Result> = <Geometry A>.Within(<Geometry B>)
<Result>: Boolean
  • True if geometry A is contained within geometry B,
  • False otherwise.
If an error occurs, the ErrorOccurred variable is set to True. To get more details on the error, use ErrorInfo with the errMessage constant.
<Geometry A>: Polygon2D variable
Name of the Polygon2D variable to be used.
<Geometry B>: Variable containing spatial data
Variable corresponding to the second geometry. This geometry can correspond to one of the following variable types:
Remarks
<Polygon2D variable>.Within is similar to <Polygon2D variable>.CoveredBy. However, <Polygon2D variable>.CoveredBy does not require the interiors of both geometries to have a point in common. A polygon covers its own boundary, but it does not contain it.

Accessing spatial data: using spatial indexes

In a data file, you can apply a filter on spatial data and loop through the file. For example, the filter can be based on the result of <Polygon2D variable>.Within.
It is recommended to use the following syntax to apply a filter on spatial data:
FOR EACH File WHERE WLanguage_function(File.Spatial_item, Spatial_variable)

where:
  • WLanguage_function corresponds to <Polygon2D variable>.Within.
  • Spatial_item is a spatial item in the data file. This item must:
    • be of type "Geographic data" or "Geometric data".
    • be defined as a "Spatial key".
  • Spatial_variable is a given spatial variable, used for comparison with the spatial item. This variable can be of type PolygonGeo, Polygon2D, etc.
Remark: The "FOR EACH File" syntax is available but not recommended, as it doesn't use spatial indexes and is therefore not optimized. In this case, the entire data file is looped through: spatial indexes are not used.
FOR EACH File
IF WLanguage_function(File.Spatial_item, Spatial_variable) = True THEN
   ...
   END
END
Business / UI classification: Business Logic
Minimum version required
  • Version 2024
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 05/27/2024

Send a report | Local help