|
|
|
|
- Accessing spatial data: using spatial indexes
GeometryIntersect (Function) In french: GéométrieIntersecte Checks whether the intersection of two geometries does not result in an empty set. Remarks:
o2DPolygon_1 is Polygon2D
Linestring2DAddPoint(o2DPolygon_1.Outline, -1.00, 3.00)
Linestring2DAddPoint(o2DPolygon_1.Outline, 0.00, 3.00)
Linestring2DAddPoint(o2DPolygon_1.Outline, -2.00, -1.00)
Linestring2DAddPoint(o2DPolygon_1.Outline, -3.00, -1.00)
Linestring2DAddPoint(o2DPolygon_1.Outline, -1.00, 3.00)
o2DPolygon_1 = GeometryCorrect(o2DPolygon_1)
o2DPolygon_2 is Polygon2D
Linestring2DAddPoint(o2DPolygon_2.Outline, 2.00, 4.00)
Linestring2DAddPoint(o2DPolygon_2.Outline, 3.00, 4.00)
Linestring2DAddPoint(o2DPolygon_2.Outline, 3.00, -2.00)
Linestring2DAddPoint(o2DPolygon_2.Outline, -2.00, -2.00)
Linestring2DAddPoint(o2DPolygon_2.Outline, 2.00, 4.00)
o2DPolygon_2 = GeometryCorrect(o2DPolygon_2)
Trace(GeometryIntersect(o2DPolygon_1, o2DPolygon_2))
o2DPolygon_1 is Polygon2D
Linestring2DAddPoint(o2DPolygon_1.Outline, -1.00, 3.00)
Linestring2DAddPoint(o2DPolygon_1.Outline, 0.00, 3.00)
Linestring2DAddPoint(o2DPolygon_1.Outline, -2.00, -1.00)
Linestring2DAddPoint(o2DPolygon_1.Outline, -3.00, -1.00)
Linestring2DAddPoint(o2DPolygon_1.Outline, -1.00, 3.00)
o2DPolygon_1 = GeometryCorrect(o2DPolygon_1)
o2DPolygon_2 is Polygon2D
Linestring2DAddPoint(o2DPolygon_2.Outline, 1.00, 4.00)
Linestring2DAddPoint(o2DPolygon_2.Outline, 3.00, 4.00)
Linestring2DAddPoint(o2DPolygon_2.Outline, 3.00, 1.00)
Linestring2DAddPoint(o2DPolygon_2.Outline, -1.00, -1.00)
Linestring2DAddPoint(o2DPolygon_2.Outline, -3.00, 1.00)
Linestring2DAddPoint(o2DPolygon_2.Outline, 1.00, 4.00)
o2DPolygon_2 = GeometryCorrect(o2DPolygon_2)
Trace(GeometryIntersect(o2DPolygon_1, o2DPolygon_2))
Syntax
<Result> = GeometryIntersect(<Geometry A> , <Geometry B>)
<Result>: Boolean - True if the intersection of two geometries does not result in an empty set,
- 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>: Variable containing spatial data First input geometry used for the intersection. This geometry can correspond to one of the following variable types: <Geometry B>: Variable containing spatial data Second input geometry used for the intersection. This geometry can correspond to one of the following variable types: Remarks 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 GeometryIntersect. 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 GeometryIntersect.
- 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 Example:
polyGeo is PolygonGeo
polyGeo.Outline.AddPoint(0n48.8187479172765, 0n1.9550104465229536)
polyGeo.Outline.AddPoint(0n48.685649220185574, 0n2.023674998054354)
polyGeo.Outline.AddPoint(0n48.82612543243871, 0n2.2106580854197566)
polyGeo = GeometryCorrect(polyGeo)
NumberOfRecords is int
FOR EACH MunicipalityData where GeometryIntersect(MunicipalityData.geometry, polyGeo)
Trace(MunicipalityData.MunicipalityName)
END
Business / UI classification: Business Logic
This page is also available for…
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|