melowntech / vts-browser-js

JavaScript WebGL 3D map rendering engine
BSD 2-Clause "Simplified" License
218 stars 42 forks source link

Geodata point appearing behind surface #180

Closed jrjdavidson closed 4 years ago

jrjdavidson commented 4 years ago

Hi again,

I made a global map of volcanoes using a freelayer, however that are located behind the planet appear through the layer. I tried playing with the visibility styling, but didn't have any success. Any thoughts? https://www.holoceneadventures.com/ivft2/world.html

jrjdavidson commented 4 years ago

Apologies, realised that the freelayer was not set on the page above. It should work now

jrjdavidson commented 4 years ago

Hi, again trying to sort this out but having no luck. I noticed that the OSM freelayers displays properly (i.e. it is hidden when on the other side of the globe see https://jsfiddle.net/7vuvgdme/) However can't see the styling so not sure how to troubleshoot the solution. Thanks.

jrjdavidson commented 4 years ago

Allright- I figured out where I went wrong - however I still think there is a bug.

When using the 'culling" style parameter, it works well to hide features such as labels and icons- however it does not work well on 'points'. However- if I set point as false, the icon is not 'clickable' ( i.e. i does not fire a click event if clicked on).

One solution I thought of is to set the point as true, but then set the point-color alpha value at 0. This cause the icon to flicker when moving, but at least the points are clickable. Finally, the solution I'm happy with is just to set the point value as true in a different style property, with the alpha value at 0. This seems to work.

` "volcanoes" : { "filter" : ["==", "#group", "Volcanoes"], "culling": 90, 'icon': true, 'icon-source': '@icon-marker', 'icon-color': [125,255,0,255], 'icon-scale': 2, 'icon-origin': 'center-center', "point-radius" : 30 , "point" : false, "point-color":[255,0,0,255],

              "label": true,
              "label-size": 19,
              "label-source": "$NAME_",
              "label-offset": [0,-20],

              "zbuffer-offset" : [-8,0,0]

          },
          "clickable point" : {
              "filter" : ["==", "#group", "Volcanoes"],
              'icon': false,
              'icon-source': '@icon-marker',
              'icon-color': [125,255,0,0],
              'icon-scale': 2,
              'icon-origin': 'center-center',
              'click-event' : true ,
              "point-radius" : 30 ,
              "point" : true,
              "point-color":[255,0,0,0],

              "label": true,
              "label-size": 19,
              "label-source": "$NAME_",
              "label-offset": [0,-20],

              "zbuffer-offset" : [-8,0,0]

          },`
jrjdavidson commented 4 years ago

sorry- that does not solve the label problem. Also you can accidentally click on a point on the other side of the planet..

jrjdavidson commented 4 years ago

sorry again - culling does work for labels, just not for points