maplibre-gl-terradraw - new drawing plugin for maplibre-gl-js
11-19, 16:00–16:25 (Pacific/Auckland), WG404

This talk introduces a new drawing plugin for MapLibre: maplibre-gl-terradraw as an alternative of historical mapbox-gl-draw. maplibre-gl-terradraw has specifically been developed for Maplbire with a simple API to bring Terra Draw to your Maplibre with a single line of code.


This talk introduces a new drawing plugin for MapLibre: maplibre-gl-terradraw.

Previously, both Mapbox and MapLibre have relied on an older plugin, mapbox-gl-draw, to provide drawing functionality in maplibre-gl-js. However, mapbox-gl-draw is no longer actively maintained, making it increasingly difficult to use with MapLibre.

As an alternative, Terra Draw maintained by James Milner, offers advanced drawing features for multiple mapping libraries, including Mapbox, MapLibre, OpenLayers, Leaflet, Google Maps, and ArcGIS, all within a unified user interface. Compared to mapbox-gl-draw, Terra Draw is significantly easier to use. However, integrating its full functionality into MapLibre still requires extensive configuration. I developed maplibre-gl-terradraw, a new plugin that enables a pre-configured drawing feature with a single line of code.

With maplibre-gl-terradraw, users can easily add drawing controls with just a line of code.

This immediately grants access to all drawing modes (point, line, polygon, rectangle, circle, etc) powered by Terra Draw. The plugin comes pre-configured with icons and additional functionalities, such as:

  • Selecting and deleting features
  • Downloading drawn features
  • Customizing Terra Draw options and styles, as described in the documentation

Furthermore, the measure control allows users to:

  • Measure the distance of a line or the area of a polygon
  • Query elevation data from raster DEM sources (MapLibre Terrain, TerrainRGB, and Terrarium)

In this talk, I will demonstrate the core functionalities of maplibre-gl-terradraw and show how easily you can integrate drawing features into your MapLibre applications.

References:

main project:
- maplibre-gl-terradraw: MIT License. https://github.com/watergis/maplibre-gl-terradraw

dependencies of the main project:
- Terra Draw: MIT License. https://github.com/JamesLMilner/terra-draw
- maplibre-gl-js: https://github.com/maplibre/maplibre-gl-js

Jin Igarashi is senior software developer working on geospatial for many years. Since I was involved in water projects as GIS developer in Eastern Africa in 2014, I develop and maintain several open source software (called GIS for water) supporting water utilities in Africa to manage and visualize water and sewerage network in the web apart from my professional work. I am passionate about driving innovation in the WASH field due to my background in information technologies and WASH experience.

This speaker also appears in: