I’m looking for a library in javascript that would allow me to make geospatial queries. I know about OpenLayers and GoogleMaps, but this two do not support things like union intersection and so on.
+----+
| |
| +-+--+
+--+-+ |
| |
+----+
to
+----+
| |
| +--+
+--+ |
| |
+----+
JSTS can do unions of geometric objects in the browser. JSTS integrates with the openlayers library and it extends openlayers geometric classes (e.g. OpenLayers.Geometry.Polygon) so they are capable of geometric operations. Example:
Geoscript JS is nice if you want to do serverside geometric operations in JS.