bp_xor
Geometric functions > bp_xor
syntax
- bp_xor(polygon_data_item1, polygon_data_item2)
description
bp_xor(polygon_data_item1, polygon_data_item2) results in a data item with the symmetric difference of the two polygon arguments. The result contains, for each element, the area covered by exactly one of the two polygon arguments (i.e., the union minus the intersection).
The operator is applied element-by-element. Both domains need to match, or one of the arguments needs to be a parameter (void domain).
The bp_ prefix of the function name indicates that the implementation of the operator uses the Boost Polygon library, which requires integer coordinates.
This operator is also automatically invoked by the ^ operator when used with ipoint or spoint polygon data items.
applies to
- attribute polygon_data_item1 with a polygon value type with integer coordinates (ipoint or spoint)
- attribute polygon_data_item2 with a polygon value type with integer coordinates (ipoint or spoint)
The value types of both arguments must be compatible (same point type).
conditions
- The composition type of both arguments needs to be polygon.
- The domains of the two arguments must match, or one argument must have a void domain (parameter).
- The polygon data items must have integer coordinates (ipoint or spoint).
This function results in problems for (integer) coordinates larger than 2^25 (after translation where the first point is moved to (0, 0)). If your integer coordinates, for instance, represent mm, 2^25[mm] = about 33 [km]. We advise you to keep the size of your integer coordinates for polygons limited.
since version
15.6.0
example
attribute<ipoint> geometry_xor (district) := bp_xor(geometry_A, geometry_B);
// equivalent to (for integer coordinates):
attribute<ipoint> geometry_xor (district) := geometry_A ^ geometry_B;