Label decluttering with a custom renderer.
Decluttering is used to avoid overlapping labels with overflow: true
set on the text style. For MultiPolygon geometries, only the widest polygon is selected in a custom geometry
function.
<!DOCTYPE html>
<html>
<head>
<title>Vector Label Decluttering</title>
<link rel="stylesheet" href="https://openlayers.org/en/v4.6.4/css/ol.css" type="text/css">
<!-- The line below is only needed for old environments like Internet Explorer and Android 4.x -->
<script src=""></script>
<script src="https://openlayers.org/en/v4.6.4/build/ol.js"></script>
<script src=""./resources/common.js">