Serve raster tiles in GeoServer and renderer them by Leaflet

Steps to handle raster data

Download

Login

Create a raster workspace

Select a store datasource

Create a raster store

Create a layer

Publish review

Layer preview

Layer preview result

Compressed raster layer with only grey band

Exception stack trace 1

Caused by: java.lang.NullPointerException at javax.media.jai.PlanarImage.getData(PlanarImage.java:2110) at javax.media.jai.StatisticsOpImage.getProperty(StatisticsOpImage.java:292) at com.sun.media.jai.opimage.ExtremaOpImage.getProperty(ExtremaOpImage.java:100) at javax.media.jai.RenderedOp$1.getProperty(RenderedOp.java:1808) at javax.media.jai.PropertyEnvironment.getProperty(PropertyEnvironment.java:197) at javax.media.jai.PropertySourceImpl.getProperty(PropertySourceImpl.java:277) at javax.media.jai.WritablePropertySourceImpl.getProperty(WritablePropertySourceImpl.java:130) at javax.media.jai.RenderedOp.getProperty(RenderedOp.java:1982) at org.geotools.image.ImageWorker.getComputedProperty(ImageWorker.java:1033) at org.geotools.image.ImageWorker.getExtremas(ImageWorker.java:1089) at org.geotools.image.ImageWorker.rescaleToBytes(ImageWorker.java:1400) at org.geotools.renderer.lite.gridcoverage2d.RasterSymbolizerHelper.execute(RasterSymbolizerHelper.java:139) at org.geotools.renderer.lite.gridcoverage2d.RasterSymbolizerHelper.execute(RasterSymbolizerHelper.java:53) at org.geotools.renderer.lite.gridcoverage2d.StyleVisitorCoverageProcessingNodeAdapter$1.execute(StyleVisitorCoverageProcessingNodeAdapter.java:97) at org.geotools.renderer.lite.gridcoverage2d.BaseCoverageProcessingNode.checkExecuted(BaseCoverageProcessingNode.java:234) at org.geotools.renderer.lite.gridcoverage2d.BaseCoverageProcessingNode.getOutput(BaseCoverageProcessingNode.java:332) ... 124 more

Exception stack trace 2

Caused by: javax.imageio.IIOException: Illegal value for Predictor in TIFF file at it.geosolutions.imageioimpl.plugins.tiff.TIFFLZWDecompressor.<init>(TIFFLZWDecompressor.java:118) at it.geosolutions.imageioimpl.plugins.tiff.TIFFImageReader.read(TIFFImageReader.java:1856) at com.sun.media.jai.imageioimpl.ImageReadOpImage.computeTile(ImageReadOpImage.java:697) ... 166 more

QGIS layer preview

QGIS geotiff layer export

GeoServer layer preview

Cause analysis

Define style in GeoServer

Create style in QGIS

Export style in QGIS

Copy the .qml content

Generate the style template in GeoServer

Specify the style content

Generate .sld in QGIS

Create style in Geoserver from .sld file

Edit layer basic info

Edit WMS Settings

Preview layer

Preview layer when editing style

Add additional styles

Preview layer with additional styles

Enable CORS for GeoServer

Clone repository

Create web.xml

Enable CORS

Docker hub modification

Build and push

./build.sh docker pull hustakin/geoserver

Tomcat error log

Client http

Renderer the raster layer in the web

Leaflet layer using WMS

Leaflet layer using WMTS

OpenLayers layer using WMTS

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store