JSTS is a JavaScript library of spatial predicates and functions for processing geometry conforming to the Simple Features Specification for SQL published by the Open Geospatial Consortium. JSTS is also a JavaScript port of the well established Java library JTS with a built in parser for OpenLayers interopability.
JSTS is licensed with a dual BSD/EPL liceence. For more details go to the project page.
NOTE: OpenLayers specific code omitted. Please refer to this page for a complete example of usage with OpenLayers 3.
var reader = new jsts.io.WKTReader()
var a = reader.read('POINT (-20 0)')
var b = reader.read('POINT (20 0)')
a = a.buffer(40)
b = b.buffer(40)
var intersection = a.intersection(b)
var difference = a.difference(b)
var union = a.union(b)
var symDifference = a.symDifference(b)