我想为线要素指定边框。在下面的代码中,我可以根据道路类型指定描边颜色,但我想在其上指定另一个边框。例如,我想为最后一个 else 语句分配一个边框。属于该类别的任何功能都应与描边颜色接壤。我怎样才能做到这一点?
<!doctype html>
<html>
<head>
<title>Vector Tiles</title>
<link rel="stylesheet" href="https://openlayers.org/en/v5.3.0/css/ol.css" type="text/css" />
<style>
.map {
width: 100%;
height: 100vh;
}
body {
margin: 0;
}
</style>
</head>
<body>
<body>
<div id="map" class="map">
<div id="popup"></div>
</div>
<script src="https://cdn.rawgit.com/openlayers/openlayers.github.io/master/en/v5.3.0/build/ol.js"></script>
<script>
var popup = new ol.Overlay({
element: document.getElementById('popup')
});
var osmLayer = new ol.layer.Tile({
source: new ol.source.OSM()
});
var styleFunction = function(feature) {
console.log(feature);
//assign symbology of roads based on road type
var color;
if (feature.get("type")=='primary' && 'secondary' && 'trunk'){ …Run Code Online (Sandbox Code Playgroud)