I have layers based on GeoTIFF files, provided by GeoServer, that are displayed as overlays over base maps from OpenStreetMaps, Bing, Google via OpenLayers. I want to mask out areas from the GeoTIFF overlays but enable the base maps to continue to their full extent / appear around the boundaries of my mask.

How to crop coverage with WPS chain in sld? had the clues for creating a SLD that includes a WPS transformation that crops a layer to a shape definition. That works fine for the layer by itself, i.e., in GeoServer's own OpenLayers layer preview. But if I display that layer on top of a base map in my application, performance of the base map layer display plummets (up to minutes to display vs nearly instantaneous), CPU usage on my laptop spikes, and I end up with pink tiles where some of the base map should be. I suspect the performance hit occurs because of the (relatively simple, 10 point but continent sized, polygon used by the cropShape definition.

This GeoTools CropCoverage source code suggests that I could use a coverage definition provided by an input raster.

My questions: Can that raster be defined as part of GeoServer WPS SLD transformation? How do I define that input raster? Is there an example somewhere? Ultimately, will that improve base map display performance or is my suspicion wrong and there is some other reason for display being so slow when there is a base map in addition to the overlay with this SLD change is made for the overlay?

  • A snippet of additional info: jvisualvm says lots of CPU time is being spent in geoserver's it.geosolutions.jaiext.piecewise.GenericPeicewiseOpImage.computerRect() when this happens.
    – jwd630
    Commented Jul 15, 2016 at 21:17
  • Areas you want to crop are fixed or dynamic ?
    – Shiko
    Commented Jul 29, 2016 at 1:45
  • Areas are static: there may be a number of masks but they will rarely change.
    – jwd630
    Commented Jul 29, 2016 at 15:11
  • What about clipping raster using gdal ?
    – Shiko
    Commented Jul 29, 2016 at 15:22
  • There are literally thousands of these raster overlays that are being masked/cropped and I don't want to duplicate them. Creating masked versions of all would also mean lots of code changes to select the correct mask/overlay combination; or to dynamically create masked version of the overlay with gdal on the fly and integrate those into geoserver. The WPS chain SLD solution works great in isolation but what's the point if you can't display that result over a base map in a timely fashion?
    – jwd630
    Commented Jul 29, 2016 at 15:51


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.