TrueGIS

Client-Side Geoprocessing with Turf.js and Web Workers

Reading time: ~9 min

Client-side geoprocessing can feel sluggish if you run heavy operations on the main thread. A simple pattern—Turf.js + Web Workers—keeps the UI responsive while you buffer, clip, dissolve, or intersect features.

When to move work off the main thread

Pattern overview

  1. Collect the minimal inputs (e.g., selected features + buffer distance).
  2. Post a message to a Worker with raw GeoJSON (or transferable ArrayBuffers).
  3. Run Turf ops in the Worker, post back the result.
  4. Render the result layer and style it (semi-transparent fills help).

Tips & gotchas

What about precision?

Browser floating-point is fine for most use cases. If you need exact topology or robust boolean ops, consider server-side pipelines—but many interactive tasks work great with Turf in a Worker.


TrueGIS focuses on fast drawing, styling, and printing for everyday web mapping. Open it now, sketch your features, and export a clean, to-scale map: TrueGIS Maps.

← Back to Blog