Clear Filters
Clear Filters

Can I use a WMS layer that has Lonlim set to [-180,360] in Matlab?

1 view (last 30 days)
I would like to use the GEBCO WMS layer as a basemap in webmaps - all good using wmsfind, refine and wmsupdate
But the GEBCO WMS is set up with Lonlim = [-180,360] - ie it's 1.5 times round the globe
When I try and use wmsread, or webmap, I get an error:
Error using webmap
Expected the 'Lonlim' value to be in the interval [-180, 180] or [0 360].
Can anyone think of a way around this?
  1 Comment
dpb
dpb on 24 Jun 2022
I "know nuthink!" as Sgt Schultz would say about WMS layers, but I see there are input parameters for wmsread for 'Lonlim' that you might be able to set to bound the return. There's a note that the input image will have to allow this for it to work, but that would be my first stab at it.
After that, I dunno what one could do about downloading raw data from server and somehow munging on it...there have to be other toolsets that can handle such; seems strange if it's possible to do that that the ML functions can't handle it....looks like an enhancement request in the making if not a quality of implementation pseudo bug.

Sign in to comment.

Answers (1)

Narvik
Narvik on 27 Oct 2023
Hi Helen Snaith,
I understand that you are facing an issue while trying to use the wmsread and webmap function with Lonlim set to [-180, 360]. This is a known limitation of the functions and is due to the data on the WMS server. The data does not conform to the WMS specification.
A workaround for this issue is to set the LonLim property of the WMSLayer object. Here is a code snippet for your reference:
layers = wmsfind('bluemarbleng');
layer = wmsupdate(layers(1));
lonlim = [min(layer.Lonlim), max(layer.Lonlim)];
layer.Lonlim = [max([-180, lonlim(1)]), min([180, lonlim(2)])];
[A,R] = wmsread(layer);
% update your layers before setting the limits
You can also refer to the following documentation link for more information on troubleshooting WMS servers:
Hope this helps!

Categories

Find more on Statistics and Machine Learning Toolbox in Help Center and File Exchange

Products


Release

R2022a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!