Official Content

Returns a Boolean with the result of the intersection of two Geography attributes or variables.

Syntax

GeographyAttOrVar1.Intersect(GeographyAttOrVar2)

Where:

GeographyAttOrVar1
   
Must be an attribute or variable based on the Geography data type or derived data types associated with geometry like the GeoPolygon data type.

GeographyAttOrVar2
   
Must be an attribute or variable based on the Geography data type or derived data types associated with geometry like the GeoPoint data type.

Type Returned:
Boolean

Scope

Generators: AppleAndroid
Level: AttributeVariable (Geography data type)

Description

This method allows solving complex algorithms such as "Point in Polygon", by leveraging the implementation of database management systems.

Samples

For example, in the code below the Geography variables are initialized with different vector data (points, lines, polygons), in this case from a WKT, and then it is calculated if they intersect. 

&Point.Fromwkt('POINT(-56.160335101195614 -34.92136488262594)')
&Polygon.Fromwkt('POLYGON((-56.204939 -34.860685, -56.073266 -34.790773 ,  -56.014571 -34.838863, -56.078718 -34.878530, -56.147716 -34.904991, -56.2002342 -34.9062892, -56.204939 -34.860685))')
&Line.Fromwkt("LINESTRING(-56.17584228515625 -34.917466889282515, -56.147518157958984 -34.91662233422328)")

&PointInPolygon = &Polygon.Intersect(&Point)  //&PointInPolygon is a Boolean variable
&LineCrossPolygon = &Polygon.Intersect(&Line) //&LineCrossPolygon is a Boolean variable

Similarly, in the code below, the Intersect method is used to solve the "Point in Polygon" case.

Consider the following Transaction object:

Neighborhood
{
  NeighborhoodId*
  NeighborhoodName
  NeighborhoodGeography
}

The following Procedure object receives the &GeoPoint variable as a parameter.

The neighborhoods stored in the database are queried performing an optimal search to find where the given point (&GeoPoint variable) is located.

Rule:
Parm(&GeoPoint);

Source:
For each Neighborhood
    Where NeighborhoodGeography.Intersect(&GeoPoint)
     &IsIntersected = True
     &PlaceName = NeighborhoodName
     exit
Endfor

See Also

FromWkt method

  

Last update: March 2025 | © GeneXus. All rights reserved. GeneXus Powered by Globant