Drawing points behind lines in OpenLayers -


i attempting create map using openlayers 4.

i have vector tiles contain lines , points. lines represent roads , points represent roundabouts. i'm trying draw roads casings , draw roundabouts casings casings roundabouts appearing behind roads. make sense? :)

here's i'm getting @ moment:

image

notice on roundabouts how stroke around them intersects roads? i'm trying avoid.

the roads styled this:

const road = [   new ol.style.style({     stroke: new ol.style.stroke({       color: '#505050',       width: 2     }),     zindex: 2   }),   new ol.style.style({     stroke: new ol.style.stroke({       color: '#ffffff',       width: 20     }),     zindex: 3   }) ]; 

i've simplified remove colouring of roads based on type etc not complicate example.

the roundabouts styled this:

const roundabout = [   new ol.style.style({     image: new ol.style.circle({       radius: 20,       fill: new ol.style.fill({         color: '#ffffff'       }),     }),     zindex: 1   }),   new ol.style.style({     image: new ol.style.circle({       radius: 18,       fill: new ol.style.fill({         color: '#ffffff'       }),     }),     zindex: 4   }) ]; 

again, simplified not include circle in middle of roundabout, same point drawn again smaller.

what should happen roundabout casing should drawn first, road casing, road filling, , roundabout filling. should give effect of road filling , roundabout filling appearing 1 continuous line, , casings flowing around roundabouts without intersecting road lanes.

the problem i'm having zindex values i'm setting roundabouts seem have no effect @ all. no matter change them to, cannot part of point (casing or fill) drawn behind line of road. can change zindex roads casing drawn in front of fill, example, no matter how big number choose can't road drawn in front of roundabout!

any ideas how can fix , points drawing them to?

thanks,

dylan

by default, openlayers renders points (i.e. roundabouts) vectors, pre-renders lines (i.e. roads) images. can controlled using ol.layer.vectortile's rendermode option, defaults 'hybrid'.

to render points , lines in same pass (in order zindex respected), configure ol.layer.vectortile rendermode: 'image' or rendermode: 'vector'.


Comments

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

.htaccess - ERR_TOO_MANY_REDIRECTS htaccess -