Trick serving a hillshade image from GeoServer

I had the perfect hillshade raster ready to throw on top of my web map, I had previewed it in QGIS and the colour stretching and values looked fine.
Hillshade in QGIS

I then loaded it into GeoServer and it looked great in the OpenLayers Layer Preview window as well.

However, once I added it as a WMS layer in a Leaflet map, I got really confused.  Even though I had my NODATA=255 parameters seemingly working well there appeared a small strip around the outside of the image that was obnoxious.

When GeoServer skews the image it creates a region around the image that has value=0.  This image already had nodata=255, so it can be very confusing.
When GeoServer skews the image it creates a region around the image that has value=0. This image already had nodata=255, so it can be very confusing.

I figured I could change it with an SLD but hadn’t done it before so it took a while to figure out.  For a couple hours I tried various permutations of the default “raster” Style, but with no luck.  The image, otherwise, looked great so the Style obviously wasn’t a real problem in and of itself.

The trick came when I realised that I need to set my color maps for the gray band explicitly.  Up to this point no particular band had been isolated for color mapping.  I found the right place to put the elements in the SLD and all worked out well.

My takeaway: there must be a better way to develop SLD for rasters.  The options in the GeoServer docs are amazing and exciting, but trying to fit them into a specific context has always been a challenge for me.  That’s why I had to write this down, but I’m sure I’ll have to remember it all again a year from now!

Note there is no skewed "collar" around the image as value=0 is ignored.
Note there is no skewed “collar” around the image as value=0 is ignored.


      Raster Hillshade
      Grayscale hillshade SLD
          Hillshade with transparency
          Ignore values outside valid range, nodata values transparent



Desktop + Processing Server = GeoShangri-La

Those who know me are likely sick of my retelling of stories about my observations on the impact of migrating away from command line GIS (circa ArcInfo Workstation) to the typical desktop GIS with graphical user interfaces. More often than not, however, my desire for server-side scripting is now done within spatial databases (Ingres and Postgres/PostGIS databases being the two I recommend the most).  The interface between the GIS client and the server is still ripe for innovation however.

While some desktop applications can leverage server-side processes, instead of pulling it all down to the client, I have seen it less in-the-wild than I have the traditional client-side approach.  I’m hopeful that with products like ArcGIS Server, GeoServer or even GIS Cloud, PyWPS, deegree, 52North, Zoo, etc. much of that work will finally be put where it belongs.

Enter the Web Processing Service (WPS) to help glue it all together.  A couple years back I barely knew this existed, but now that it is easy to enable this on GeoServer, it’s starting to draw my attention more and more.  However, I can’t help but think that lack of client support is hampering the adoption of a WPS-based workflow.  When I saw there was a WPS plugin for QGIS then I really started paying attention!

Here’s why…

Imagine having layers loaded, say, through a WFS.  So you’re just drawing some features, selecting a few and then sending off a request to the server to process a buffer or to do a clip function.  Behind the scenes, QGIS would send just the select shape of interest, tell the server what process to run (along with some other parameters) and return the result to your map view.  Only a few local temporary files and all is done in one spot and kept clean.

Too good to be true?  You be the judge and let me know 🙂

p.s. The ultimate end game for me here is to have my Ingres spatial db serving up customer data via WFS, with options to process the data with GeoServer WPS.  I’ve tested against other platforms with more success, but I’ve only gotten halfway there with GeoServer.  If you’ve done QGIS with WPS plugin against a GeoServer WPS instance, I’d like to hear from you (twitter: spatialguru).  I can get it to create a grid, for example, but I can’t get the client to send data to the server and get a result.

%d bloggers like this: