ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

New WINDEV, WEBDEV and WINDEV Mobile 2024 feature!
Help / WLanguage / Managing databases / HFSQL / 
  • Parcours des données spatiales : utilisation des index spatiaux
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
Checks whether two geometries have a non-empty intersection.
Remarks:
Example
// Example 1: two disjoint polygons
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)
// Add last point (same as first)
Linestring2DAddPoint(o2DPolygon_1.Outline, -1.00, 3.00)
// Corrects the new geometry
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)
// Add last point (same as first)
Linestring2DAddPoint(o2DPolygon_2.Outline, 2.00, 4.00)
// Corrects the new geometry
o2DPolygon_2 = GeometryCorrect(o2DPolygon_2)

Trace(GeometryIntersect(o2DPolygon_1, o2DPolygon_2)) // False
// Example 2: two polygons with an intersection
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)
// Add last point (same as first)
Linestring2DAddPoint(o2DPolygon_1.Outline, -1.00, 3.00)
// Corrects the new geometry
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)
// Add last point (same as first)
Linestring2DAddPoint(o2DPolygon_2.Outline, 1.00, 4.00)
// Corrects the new geometry
o2DPolygon_2 = GeometryCorrect(o2DPolygon_2)

Trace(GeometryIntersect(o2DPolygon_1, o2DPolygon_2)) // True
Syntax
<Result> = GeometryIntersect(<Geometry A> , <Geometry B>)
<Result>: Boolean
  • True if the two geometries have a non-empty intersection,
  • 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

Parcours des données spatiales : utilisation des index spatiaux

Il est possible d'effectuer un parcours sur un fichier de données avec un filtre concernant des données spatiales. Par exemple, le filtre utilisé peut être basé sur le résultat de la fonction GeometryIntersect.
Pour optimiser ce filtre sur des données spatiales, il est recommandé d'utiliser les index spatiaux via la syntaxe suivante :
POUR TOUT Fichier AVEC Fonction_WLangage(Fichier.RubriqueSpatiale, variable_spatiale)

où :
  • Fonction_WLangage correspond à la fonction GeometryIntersect.
  • Rubrique_spatiale correspond à une rubrique spatiale du fichier de données. Cette rubrique doit :
    • être de type "Données géographiques" ou de type "Données géométriques".
    • être définie comme une "Clé spatiale".
  • Variable_spatiale correspond à une variable spatiale donnée, utilisée pour la comparaison avec la rubrique spatiale. Cette variable est par exemple, une variable de type PolygoneGéo, Polygone2D, etc.
Remarque : Bien que disponible, la syntaxe "POUR TOUT Fichier" n'est pas recommandée car cette syntaxe n'utilisant pas les index spatiaux, ses performances ne sont pas optimisées. Effet, dans ce cas, tout le fichier de données est parcouru : les index spatiaux ne sont pas utilisés.
POUR TOUT Fichier
SI Fonction_WLangage(Fichier.Rubrique_spatiale, Variable_spatiale) = Vrai ALORS
   ...
   FIN
FIN
Example:
// Define a triangle delimiting a geographic area
// Store this triangle in a variable of type PolygonGeo 
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)
// Search for towns with territory within the specified triangle
NumberOfRecords is int
FOR EACH MunicipalityData where GeometryIntersect(MunicipalityData.geometry, polyGeo) 
	// Name of municipality in a trace window
	Trace(MunicipalityData.MunicipalityName)
END
Business / UI classification: Business Logic
Component: wd290hf.dll
Minimum version required
  • Version 2024
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 05/21/2024

Send a report | Local help