1

I'm attempting to serve netCDFs to a Leaflet map using Geoserver (2.12.1) and its NetCDF extension. I can set up the layers and get Leaflet to receive tiles over WCS 1.0.0 without a problem, but the tiles appear to distort as I scroll the map westward:

Zoomed in view of Australia looks fine.

Zooming out also looks fine (although I note that tiles are not served in a 'wrapped' fashion).

But if I scroll westward, the WCS layer distorts.

One possible reason is that, as in this question, these NetCDFs use longitude 0:+360, rather than -180:+180. (EDIT: I've confirmed that the distortion only occurs when tiles with X < 0 are requested.) I've tried a few solutions to preprocess the files to -180:+180, but they don't appear to change the output to Leaflet, even if I can verify the changed longitude in something like ncview.

Can anyone help me figure out what the problem is here (whether it's the longitude or something else)? Ideally, I'd like Geoserver to process the files as they are, as they're CF-compliant and I'd prefer to put less preprocessing on the folks who'll be giving me these files in the future if possible. Is there a version of EPSG:4326 that can handle this shifted longitude, or is there an option in Geoserver that can handle it? or is the problem something else entirely?

4
  • What's the CRS of the map tiles you're loading into Leaflet? Feb 20, 2018 at 23:27
  • I've tried EPSG:4326 for both native and declared, and also changing declared to EPSG:3857 (with Reproject native to declared selected). Both seem to give the same result. It seems like the native CRS is read from the file, rather than being something I can configure?
    – jimjamslam
    Feb 20, 2018 at 23:29
  • I should also note that EPSG:4326 are the only options for 'Request SRS' and 'Response SRS' under the layer's WCS settings. Is it possible to check on the Leaflet end what it's receiving?
    – jimjamslam
    Feb 20, 2018 at 23:35
  • Checking Geoserver's output, it's reporting that it's outputting EPSG:3857, and the envelope coordinates reported (in 3857) match the request URLs on the browser side.
    – jimjamslam
    Feb 21, 2018 at 0:06

1 Answer 1

1

It appears that Geoserver supports longitudes > 180, as well as continuous longitudinal wrapping, in WMS as of Geoserver 2.10. Compare my WCS request, which gave the output above...

L.nonTiledLayer.wcs(
  geoserver_base + "/climdex-test/wcs?",
  {
    wcsOptions:
    {
      service: 'WCS',
      version: '1.0.0',
      request: 'GetCoverage',
      coverage: 'climdex-test:tasmax',
      crs: 'EPSG:3857',
      format: 'GeoTIFF'
    },
    displayMin: 220,
    displayMax: 320,
    // colorScale: 'rainbow',
    clampLow: false,
    clampHigh: false,
    uppercase: true,
    useCanvas: true,
    colorScale: 'magma'
  }).setOpacity(0.5).addTo(mymap);

... to a WMS request:

L.tileLayer.wms(
  geoserver_base + '/climdex-test/wms?',
  {
    service: 'WMS',
    version: '1.1.0',
    request: 'GetMap',
    layers: 'climdex-test:tasmax',
    format: 'image/png'
  }
).setOpacity(0.5).addTo(mymap);

Proper scaling with WMS! Yay

Can't find any explicit mention in recent changelogs of this feature being brought to WCS. It would certainly be nice, since I'd really like to be able to have more client-side control over the aesthetics of the layer, but it looks like this might be an acceptable compromise for now.

2
  • 1
    Any time you want a new feature/improvement brought to GeoServer this is your go-to guide: github.com/geoserver/geoserver/wiki/… Feb 21, 2018 at 8:48
  • Thanks, @AndreaAime! I'm not sure whether I have the bandwidth to work on it myself, so maybe a feature request isn't appropriate right now, going by that guide. I cross-postwd this question to geoserver-users, though, so maybe it'll generate some interest ☺️
    – jimjamslam
    Feb 21, 2018 at 9:00

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.