# WMS - Web Map Services displays

**URL:** <https://discourse.julialang.org/t/wms-web-map-services-displays/14483>\
**Category:** Geo\
**Created:** [September 3, 2018, 1:56pm UTC](https://discourse.julialang.org/t/wms-web-map-services-displays/14483 "2018-09-03T13:56:04Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![johnh](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/johnh/32/3615_2.png) [@johnh](https://discourse.julialang.org/u/johnh)\
**Post date:** [September 3, 2018, 1:56pm UTC](https://discourse.julialang.org/t/wms-web-map-services-displays/14483/1 "2018-09-03T13:56:04Z")

</div>

May I ask if anyone is familiar with WMS displays of data [Web Map Service - MATLAB & Simulink - MathWorks United Kingdom](https://uk.mathworks.com/help/map/web-map-service.html)  
[Web Map Service - Wikipedia](https://en.wikipedia.org/wiki/Web_Map_Service)

I ask for a good reason, as I would like to do some example plots using this in Julia. Yes, I should Google before I ask. However there is sually a great deal of knowledge on this forum!

Thanks in advance

---

<div class="post-metadata">

**Author:** ![visr](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/visr/32/17204_2.png) [@visr](https://discourse.julialang.org/u/visr)\
**Post date:** [September 3, 2018, 4:08pm UTC](https://discourse.julialang.org/t/wms-web-map-services-displays/14483/2 "2018-09-03T16:08:28Z")

</div>

As far as I know there are no WMS client libraries in Julia. With PyCall you could try using this:  
[https://geopython.github.io/OWSLib/](https://geopython.github.io/OWSLib/)

If the data is avaiable as web tiles (slippy map) or vector tiles you can have a look at  
[https://github.com/yeesian/MapTiles.jl](https://github.com/yeesian/MapTiles.jl)

---

<div class="post-metadata">

**Author:** ![johnh](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/johnh/32/3615_2.png) [@johnh](https://discourse.julialang.org/u/johnh)\
**Post date:** [September 3, 2018, 4:40pm UTC](https://discourse.julialang.org/t/wms-web-map-services-displays/14483/3 "2018-09-03T16:40:01Z")

</div>

@visr Thankyou. Good information.

---

<div class="post-metadata">

**Author:** ![johnh](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/johnh/32/3615_2.png) [@johnh](https://discourse.julialang.org/u/johnh)\
**Post date:** [September 3, 2018, 5:41pm UTC](https://discourse.julialang.org/t/wms-web-map-services-displays/14483/4 "2018-09-03T17:41:52Z")

</div>

I am wanting to display wind speeds and wave heights on plots of the ocean, on web based displays. If anyone is doing work like this please drop me a message and give me a street in the correct direction. Nautical pun slightly intended.

---

<div class="post-metadata">

**Author:** ![scelles](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/scelles/32/220408_2.png) [@scelles](https://discourse.julialang.org/u/scelles)\
**Post date:** [February 4, 2021, 6:55am UTC](https://discourse.julialang.org/t/wms-web-map-services-displays/14483/5 "2021-02-04T06:55:46Z")

</div>

Supporting also [WMTS (Web Map Tile Service)](https://en.wikipedia.org/wiki/Web_Map_Tile_Service) and offline maps using [MBTiles](https://github.com/mapbox/mbtiles-spec/blob/master/1.1/spec.md) format will be a great feature to have in Julia.

MBTiles files can be generated using Java software [MOBAC (MOBile Atlas Creator](https://mobac.sourceforge.io/) by fetching various map sources and storing maps offline.

MBTiles files can be displayed using Qt/C++ software [GPXSee](https://www.gpxsee.org/) which can also handle [WMS (Web Map Service)](https://en.wikipedia.org/wiki/Web_Map_Service) and [WMTS (Web Map Tile Service)](https://en.wikipedia.org/wiki/Web_Map_Tile_Service).

---

<div class="post-metadata">

**Author:** ![Alexander-Barth](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/alexander-barth/32/3692_2.png) [@Alexander-Barth](https://discourse.julialang.org/u/Alexander-Barth)\
**Post date:** [February 22, 2022, 2:28pm UTC](https://discourse.julialang.org/t/wms-web-map-services-displays/14483/6 "2022-02-22T14:28:12Z")

</div>

> [@johnh](#):
>
> Yes, I should Google before I ask.

This thread is now the top google result for “WMS julia” 😀  
Here is some small script that might be helpful:

```julia
using Dates
using PyPlot
using Statistics
using Images

module WMS
using HTTP
using Images

function map(baseurl,service = "WMS", version = v"1.3.0", request = "GetMap"; kwargs...)
    args = Dict(kwargs)
    args[:service] = service
    args[:request] = request
    args[:version] = string(version)
    args[:time] = string(args[:time],'Z')
    args[:layers] = join(args[:layers],',')
    args[:bbox] = join(string.(args[:bbox]),',')

    r = HTTP.get(baseurl,query = args)
    return Images.load(IOBuffer(r.body))
end
end

west, east = 9, 22
south, north = 32, 43

img = WMS.map("https://gibs-c.earthdata.nasa.gov/wms/epsg4326/best/wms.cgi",
            time = DateTime(2021,10,29),
            layers = ["MODIS_Terra_CorrectedReflectance_TrueColor"],
            format = "image/jpeg",
            bbox = [south,west,north,east],
            width = 512,
            height = 512,
            crs = "epsg:4326")

# Matrix{RGB{N0f8}} -> Array{Float32, 3} (height x width x 3) for imshow
data = float.(permutedims(Images.channelview(img),(2,3,1)))
imshow(data, extent = [west, east, south, north])
gca().set_aspect(1/cosd(mean((south, north))))

```

This example produces this image with PyPlot. (`WMS.map` returns a image which should be useful with other plotting frameworks).

![Figure_1](https://global.discourse-cdn.com/julialang/original/3X/0/2/0289e1cef32c0e1a7f2ec3b409734ef852f6c7a8.png)

---

<div class="post-metadata">

**Author:** ![rafael.guerra](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rafael.guerra/32/216610_2.png) [@rafael.guerra](https://discourse.julialang.org/u/rafael.guerra)\
**Post date:** [February 22, 2022, 4:39pm UTC](https://discourse.julialang.org/t/wms-web-map-services-displays/14483/7 "2022-02-22T16:39:28Z")

</div>

@Alexander-Barth, this looks great. Would you know what is the resolution of the images?

---

<div class="post-metadata">

**Author:** ![Alexander-Barth](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/alexander-barth/32/3692_2.png) [@Alexander-Barth](https://discourse.julialang.org/u/Alexander-Barth)\
**Post date:** [February 22, 2022, 4:59pm UTC](https://discourse.julialang.org/t/wms-web-map-services-displays/14483/8 "2022-02-22T16:59:59Z")

</div>

Apparently the maximal spatial resolution is 250 m:

[https://rdrr.io/cran/ursa/man/get\_earthdata.html](https://rdrr.io/cran/ursa/man/get_earthdata.html)

> **[MODIS Web](https://modis.gsfc.nasa.gov/data/)**
>
> The Moderate Resolution Imaging Spectroradiometer website that houses all central information on the MODIS project

---

<div class="post-metadata">

**Author:** ![rafael.guerra](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rafael.guerra/32/216610_2.png) [@rafael.guerra](https://discourse.julialang.org/u/rafael.guerra)\
**Post date:** [February 22, 2022, 5:05pm UTC](https://discourse.julialang.org/t/wms-web-map-services-displays/14483/9 "2022-02-22T17:05:02Z")

</div>

Thank you for your time and response. Fyi, searching in the NASA site blog, found [this post](https://wiki.earthdata.nasa.gov/pages/viewpage.action?pageId=195432390) that indicates that last year they had released 30 m resolution to the public?

The Google Earth images seem to have higher resolution than that and might be accessed throught the [EarthEngine.jl](https://docs.juliahub.com/EarthEngine/jof0K/0.3.2/) package (never tried it).

---

<div class="post-metadata">

**Author:** ![joa-quim](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/joa-quim/32/227_2.png) [@joa-quim](https://discourse.julialang.org/u/joa-quim)\
**Post date:** [February 22, 2022, 6:43pm UTC](https://discourse.julialang.org/t/wms-web-map-services-displays/14483/10 "2022-02-22T18:43:21Z")

</div>

Funny, also found that thread and implemented a (semi) WMS in GMT based on GDAL. I’m saying _semi_ because apparently GDAL does not read all WMS services (and I also have quite limited knowledge on the matter).

```julia
using GMT
wms = wmsinfo("http://tiles.maps.eox.at/wms?");
img = wmsread(wms, layer=3, region=(-10,-5,37,44), pixelsize=1500); # one can go up to pixelsize=10 meters)
imshow(img)

```

 ![GMTjl_tmp](https://global.discourse-cdn.com/julialang/original/3X/0/0/006020946eb431de4013210d48c28447c7fcf3d1.jpeg)

---

<div class="post-metadata">

**Author:** ![joa-quim](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/joa-quim/32/227_2.png) [@joa-quim](https://discourse.julialang.org/u/joa-quim)\
**Post date:** [February 23, 2022, 2:56pm UTC](https://discourse.julialang.org/t/wms-web-map-services-displays/14483/11 "2022-02-23T14:56:13Z")

</div>

@Alexander-Barth thanks for the pointer to the `time`. I’ve include that option in GMT `wms` functions and I can now reproduce your example with

```julia
using GMT
wms = wmsinfo("https://gibs-c.earthdata.nasa.gov/wms/epsg4326/best/wms.cgi");
img = wmsread(wms, layer="MODIS_Terra_CorrectedReflectance_TrueColor", region=(9,22,32,43), time="2021-10-29T00:00:00", pixelsize=750);
imshow(img, proj=:guess, dpi=75) # Degraded resolution to keep it *not-too-big*

```

And, in this particular regard, I think this (translated/adapted from a Python one) tutorial may be interesting too.  
[https://www.generic-mapping-tools.org/RemoteS.jl/dev/gallery/HLS/cloud-native-hls-data/](https://www.generic-mapping-tools.org/RemoteS.jl/dev/gallery/HLS/cloud-native-hls-data/)

 ![GMTjl_tmp](https://global.discourse-cdn.com/julialang/original/3X/5/9/59c86c19a53674aeb618ceeae250f0d0f58dd5d8.jpeg)

---

<div class="post-metadata">

**Author:** ![Alexander-Barth](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/alexander-barth/32/3692_2.png) [@Alexander-Barth](https://discourse.julialang.org/u/Alexander-Barth)\
**Post date:** [February 23, 2022, 4:47pm UTC](https://discourse.julialang.org/t/wms-web-map-services-displays/14483/12 "2022-02-23T16:47:10Z")

</div>

Thank you for sharing the tutorial ! I have also been working on a STAC client [here](https://github.com/JuliaClimate/STAC.jl): essentially it helps with the JSON parsing and with searching. The idea is that catalog behaves like a julia “dictionary” of subcatalogs.

```julia
using STAC
catalog = STAC.Catalog("https://cmr.earthdata.nasa.gov/stac/")
# LPCLOUD is here the id of the sub-catalog
@show catalog["LPCLOUD"]

```

---

<div class="post-metadata">

**Author:** ![joa-quim](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/joa-quim/32/227_2.png) [@joa-quim](https://discourse.julialang.org/u/joa-quim)\
**Post date:** [February 23, 2022, 8:30pm UTC](https://discourse.julialang.org/t/wms-web-map-services-displays/14483/13 "2022-02-23T20:30:45Z")

</div>

Thanks, I’ll look at it in a future revision of that tutorial. I find it to cryptic but that’s how it was in Python and mostly wanted to be able to reproduce it in Julia.
