Measure distance and length of feature
This example shows how you can calculate length of line and area of polygon by using MaplibreMeasureControl when you input a line or a polygon.
Getting start with installing the package
Copy and paste the below code.
This example shows how you can calculate length of line and area of polygon by using MaplibreMeasureControl when you input a line or a polygon.
You can add GeoJSON features by using addFeatures() function in the TerraDraw instance which can be retrieved through getTerraDrawInstance() function.
You can add GeoJSON features with custom style by using addFeatures() function in the TerraDraw instance which can be retrieved through getTerraDrawInstance() function.
This plugin provides a function getTerraDrawInstance to fetch the instance of TerraDraw itself. Using this instance, you can use all APIs supported by TerraDaraw. For example, the below code is to subscribe TerraDraw's select event to show selected feature as GeoJSON string.
This plugin tries to optimise the better drawing options for each Terra Draw mode. However, preconfigured drawing options might not be desired for your app. For example, if you only want to use polygon control,but you don't want users to drag a polygon or adding/deleting a node on an edge of a polygon, the following setting can be done.
TerraDraw usesd 9 digits as default coordinate precision. You can use different coordinate precision instead.
This plugin provides default icons for each TerraDraw mode button. You can change default icon if you would like to use your own.
This example shows how you can calculate length of line and query elevation from maplibre raster-dem terrain source.
This example shows how you can calculate length of line and query elevation from custom TerrainRGB DEM dataset.
The plugin use default color styling provided by TerraDraw. This example shows you how to customise drawing style.