|
|
|
|
|
- Examples
- Accessing spatial data using spatial indexes
<Polygon2D variable>.Cross (Function) In french: <Variable Polygone2D>.Croise Determines if a 2D polygon crosses another geometry.
It can be considered that one geometry crosses another if: - The interiors of geometry A and geometry B have at least one point in common.
- The interior of geometry A does not have all its points in the interior of geometry B, and vice versa. Geometry A must not contain geometry B and geometry B must not contain geometry A.
- The intersection of the interiors must have a dimension less than the maximum dimension of the input geometries.
o2DPolygon_1 is Polygon2D
o2DPolygon_1.Outline.AddPoint(-2.00, 1.00)
o2DPolygon_1.Outline.AddPoint(2.00, 1.00)
o2DPolygon_1.Outline.AddPoint(2.00, -1.00)
o2DPolygon_1.Outline.AddPoint(-2.00, -1.00)
o2DPolygon_1.Outline.AddPoint(-2.00, 1.00)
o2DPolygon_1 = o2DPolygon_1.Correct()
oLinestring is Linestring2D
oLinestring.AddPoint(0.00, 2.00)
oLinestring.AddPoint(-2.00, -2.00)
oLinestring = oLinestring.Correct()
Trace(oLinestring.Cross(o2DPolygon_1))
Syntax
<Result> = <Geometry A>.Cross(<Geometry B>)
<Result>: Boolean - True if geometry A crosses 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 Examples Example 1: Crossing polygons Two polygons (with a dimension of 2) whose interiors have points in common do not cross. In this case, their intersection is also a polygon, whose dimension is equal to the dimension of the two geometries (2). However, these polygons overlap and intersect. In this case: - <Polygon2D variable>.Cross returns False.
- a non-fatal error is raised if two polygons are passed to <Polygon2D variable>.Cross.
Example 2: Linestring and polygon: A linestring that passes through a polygon and has points outside the polygon, crosses the polygon. The intersection between the two geometries is a linestring, whose dimension is smaller than that of the polygon. Accessing spatial data using spatial indexes In a data file, you can apply a filter on spatial data and loop through the data file. For example, the filter can be based on the result of <Polygon2D variable>.Cross. 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>.Cross.
- 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.
Note: 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 and 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
This page is also available for…
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|