ghettovoice / vuelayers

Web map Vue components with the power of OpenLayers
https://vuelayers.github.io/
MIT License
681 stars 230 forks source link

Is hillshading possible (with raster-dem files)? #428

Closed DiegoTheWolf closed 3 years ago

DiegoTheWolf commented 3 years ago

Hallo,

i didn't find any source for DEM files. Is it possible, or will it be possible in the future, to use raster-DEM files for terrain height and therefore hillshading?

Thank you in advance!

ghettovoice commented 3 years ago

Hello @DiegoTheWolf , OpenLayers and therefor VueLayers not supporting 3d maps. But the OpenLayers team provides additional lib ol-cesium that do this.

I'm not a big expert in this area, but seems like ol-cesium can work with DEM files. But you need some additional plugin for Cesium to serve DEM data. Here is a SO question that I found: https://gis.stackexchange.com/questions/150861/does-ol3-cesium-accept-dem-files

As for integration of ol-cesium with vuelayers, the example below shows how to run :

<template>
  <vl-map ... @created="mapCreated">
    <vl-view ... />
    ....
  </vl-map>
</template>

<script>
import OLCesium from 'olcs/OLCesium.js';
import * as Cesium from 'cesium';

export default {
  methods: {
    mapCreated (vm) {
        const ol3d = new OLCesium({map: ol2dMap}); // ol2dMap is the ol.Map instance
        const scene = ol3d.getCesiumScene();
        scene.terrainProvider = new Cesium.CesiumTerrainProvider({
            // here you can provide your own tileset url, but seems you need geoserver with a special plugin (check the so question above)
            url: '//cesiumjs.org/stk-terrain/tilesets/world/tiles'
        });
        ol3d.setEnabled(true);
    },
  },
}
</script>

I'm not sure if it will work without errors... I can't reproduce such demo anywhere on some public demo site like jsfiddle, because they don't allow to CORS for this tileset url and I don't have any other opportunity to deploy such setup myself. So it is just an example adopted from ol-cesium docs and I hope it should work

stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.