Skip to main content

equals

Returns true if geometries a and b are topologically equal.

Geometry a is topologically equal to geometry b if their interiors intersect and no part of the interior or boundary of one geometry intersects the exterior of the other.

That means that the geometries must have the same dimension, and they occupy the same space. They do not need to have the same vertices or even the same type (MultiLine can be equal to Line, GeometryCollection to Polygon etc).

Like other spatial predicates, equals operates in 2D only; it ignores any Z or M ordinates.

warning

Do not use this function with invalid geometries. You will get unexpected results.

Parameters

NameTypeDescription
aGeometryFirst geometry
bGeometrySecond geometry

Returns

boolean

true if geometry a is topologically equal to geometry b

Throws

  • GEOSError on unsupported geometry types (curved)

See also

  • equalsExact checks whether two geometries are of the same type and have the same vertices in the same order on the XY plane
  • equalsIdentical checks whether two geometries are of the same type and have exactly the same vertices in the same order on the XYZM plane

Examples