Terra Draw, a Cross-Library Drawing API
James Milner released an alpha version of Terra Draw, a JavaScript library that implements adapters centralising drawing functions across different map libraries. Instead of building functionality to draw rectangles, lines, or points for each mapping API, you can now learn Terra Draw and be done with it.
Leaflet, MapboxGL and Google Maps are supported; of the major contemporary libraries, only OpenLayers and MapLibre are currently missing. Terra Draw supports creating and editing points, lines, polygons, and circles and even includes a freehand tool.
Most products are set on one mapping library, and Terra Draw will be less valuable. But there are a couple of scenarios where Terra Draw is useful. Terra Draw could be an option if you’re building a new product and haven’t decided (or don’t want to commit) to one mapping library or base map provider. It allows you to focus on the problem, not the technology. In consulting, when different projects often require a different provider, Terra Draw allows transferring solutions across various projects, potentially freeing up time to work on other things. And TerraDraw enables you to adhere to engineering best practices: The drawing implementation is abstracted away so you can switch libraries later; for example, when a vendor decides to change to a more restrictive proprietary license.