Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wmsread fails on wms=wmsinfo("http://ows.mundialis.de/services/service") #1500

Open
robot144 opened this issue Aug 19, 2024 · 2 comments
Open

Comments

@robot144
Copy link

robot144 commented Aug 19, 2024

Hi,

When trying the following code:
`wms=wmsinfo("http://ows.mundialis.de/services/service")
img = wmsread(wms, layer="OSM-WMS", region=(0.0,2.0,50.0,52.0), size=(800,800));
imshow(img)

`
The image is mostly blue. After some searching this seems to result from wmsinfo setting the wms.layer[i].srs to the wrong values. When I overrule the srs by "EPSG:4326" then it does work. Not that the struct for a layer is not mutable, so I used:

#  struct GMT.WMSlayer
#  name          :: String
#  title         :: String
#  srs           :: String
#  crs           :: String
#  bbox          :: NTuple{4, Float64}
#  imgformat     :: String
#  tilesize      :: Int64
#  overviewcount :: Int64
#  resolution    :: Float64
#  tiled         :: Bool
#  transparent   :: Bool
l1_new=GMT.WMSlayer(l1.name,l1.title,"EPSG:4326",l1.crs,l1.bbox,l1.imgformat,l1.tilesize,l1.overviewcount,l1.resolution,l1.tiled,l1.transparent)
wms.layer[1]=l1_new

I guess that the parsing of the variable f fails in function wmsinfo in file webmapserver.jl around line 51 fails.
It would be nice if this could be fixed, but I don't dare to try this myself, since I am new to GMT.jl

Many thanks for the nice package,
Martin

@joa-quim
Copy link
Member

Hi Martin, thanks for looking for the error. I’m on mobile so can’t check it right now.
But don’t be afraid to screw anything in the code. You can’t. If you fork the project and install it locally you can do all experiments you want and if you manage to fix it than you can submit a PR (Pull Request).

@joa-quim
Copy link
Member

OK, found things. There is no parsing error. What happens is that the data is in Spherical Mercator and you are asking a region in geographic. Apparently the server also accepts that wee pass in a SRS on geographics and that is why your patch worked. Don't know if this is a general rule but I added a option to wmsread that forces setting the SRS to EPSG:4326. In master you can now do

img = wmsread(wms, layer="OSM-WMS", region=(0.0,2.0,50.0,52.0), size=(800,800), forcegeog=true);    # or geog=true

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants