ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

New WINDEV, WEBDEV and WINDEV Mobile 2024 feature!
Help / WLanguage / Managing databases / HFSQL / 
  • Examples
  • 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
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.
Example
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)
// Add last point (same as first)
o2DPolygon_1.Outline.AddPoint(-2.00, 1.00)
// Corrects the new geometry
o2DPolygon_1 = o2DPolygon_1.Correct()

oLinestring is Linestring2D
oLinestring.AddPoint(0.00, 2.00)
oLinestring.AddPoint(-2.00, -2.00)
// Corrects the new geometry
oLinestring = oLinestring.Correct()

// The linestring crosses the first polygon
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.

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 <Polygon2D variable>.Cross.
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 <Polygon2D variable>.Cross.
  • 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
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/24/2024

Send a report | Local help