npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

cesium-geoserverterrainprovider

v0.8.0

Published

plugin to create a Cesium terrain provider from Geoserver

Downloads

5

Readme

cesium-GeoserverTerrainProvider

GeoserverTerrainProvider: A terrain provider which works with geoserver providing elevation datas in bil, png, gif and jpeg formats. The png format should be prefered.

Cesium version

Tested with Cesium 1.95 and geoserver 2.21.

License: Apache 2.0. Free for commercial and non-commercial use. See LICENSE.md.

Usage

  • Optional: import mySLD.xml as a new style in geoserver to render your layer (16 bits grayscale) in other color range.
  • Import the GeoserverTerrainProvider.js file into your html codes after importing Cesium.js.
  • Create a new instance of GeoserverTerrainProvider with url of your geoserver and name of elevation layer.

After that, the GeoserverTerrainProvider will determine the capabilities of geoserver (request getCapabilities) and will be ready to provide terrain data.

Example

    <script src="/path/to/Cesium.js" type="text/javascript"></script>
    <script src="/path/to/GeoserverTerrainProvider.js" type="text/javascript"></script>
    <body>
    <div id="cesiumContainer"></div>
    <script>
      async function init(){
        const container = document.getElementById('cesiumContainer');
        const terrainProvider = await Cesium.GeoserverTerrainProvider({
              "url": "http://localhost:8080/geoserver",
              "layerName": "elevation:SRTM90"
        });
        const imageryProvider = new Cesium.WebMapServiceImageryProvider({
          "url": "http://localhost:8080/geoserver/ows",
          "parameters": {
                  "format": "image/png",
                  "transparent": true
                },
          "layers": "raster:naturalEarthPyramid",
          "maximumLevel": 15
        });

        const options = {
          imageryProvider: imageryProvider,
          baseLayerPicker: false,
          showRenderLoopErrors: true,
          animation: true,
          fullscreenButton: false,
          geocoder: false,
          homeButton: false,
          infoBox: false,
          sceneModePicker: true,
          selectionIndicator: false,
          timeline: false,
          navigationHelpButton: false,
          navigationInstructionsInitiallyVisible: false,
          targetFrameRate: 30,
          terrainExaggeration: 1.0,
        };

        viewer = new Cesium.Viewer(container, options);
        viewer.terrainProvider = terrainProvider;
      }
      init();
    </script>
  </body>

Where

Display created with bing map imagery provider and geoserverTerrainProvider. This last was configured with SRTM map of 90 meters resolution.

More precisions on styleName parameter

  • You'll find "styleName" parameter after inserting mySLD.xml as a new style usable for the elevation layer (here it's grayToColor)

The "styleName" parameter is useful when bil plugin can't provide good data. Nevertheless it takes lots of time to geoserver to generate a new image with style. Beforehand, thank to GeoWebCache you can generate the styled images (very long process).

Which format?

GeoserverTerrainProvider can work with BIL/DDS (use of BIL/DDS plugin in geoserver), styled Images (use of mySLD.xml) and converted Images (see here). The images have to be process by internet navigator also the image formats are gif, jpeg and png.

Original geotiff

It's a 16 bit grayscale geotiff used by BIL/DDS plugin to generate an arrayData.

Styled geotiff

It's a 8 bits red green blue geotiff format that geoserver serves as an image where most significant byte from 16 bit grayscale is stored in color red and least significant byte from 16 bit grayscale is stored in color green. Moreover there is an offset of 32768 meters in order to have only positive numbers.

Converted geotiff BREAKING CHANGE

It's a 8 bits red green blue geotiff format that geoserver serves as an image where most significant byte from 16 bit grayscale is stored in color red and least significant byte from 16 bit grayscale is stored in color green. Moreover there is an offset of 32768 meters in order to have only positive numbers. The third color (blue) indicates if the pixel has a no data value.

In nutshell

Which service ?

GeoserverTerrainProvider can use:

  • Web Map Service provided by geoserver or geoWebCache (version 1.1.1 and version 1.3.0) more details here
  • Tile Map Service provided by geoWebCache (version 1.0) here
  • Web Map Tile Service provided by geoWebCache (version 1.0) here

Little helps to use SRTM (elevation maps) in geoserver

  • you can download SRTM data at http://srtm.csi.cgiar.org/ or http://www.viewfinderpanoramas.org/ (90 meters or 3 seconds arc resolution of map is better)
  • install GDAL tools and python to work with SRTM http://trac.osgeo.org/gdal/wiki/DownloadingGdalBinaries
  • install geoserver image pyramid plugin
  • generate a pyramid from SRTM data with gdal_retile command from GDAL tools
  • create a layer from generated pyramid ( a guide is available here)