Question

Download all tiles from a WMS Server

  • 20 June 2019
  • 8 replies
  • 26 views

Badge

Hi,

I wonder if it's possible to download all the tiles from a WMS web server. I would like to cache them as a Geopackage Tiles for exemple or XYZ Tile layers.

 

 

Do you know if this is possible ?

 

Thanks,

Arnaud


8 replies

Badge +11

Hi @arnaud974, That could be a loaded question. How much data do you think you might be pulling? And at what tiling level? Does this particular WMS Server support Tiling level? The data volume you are attempting to work with... This could add up very fast.

As for FME's ability, yes, should be able to connect to the WMS Server... and then you can work on storing this in Geopackage. There may be some work you'll need to do between the source (WMS Reader) and the destination format (GeoPackage).

Do you have FME now? Have you attempted this already and not been able to get it done?

Badge

Hi @steveatsafe,

The volume of data should not be to big as the area I am working on is not really large and yes the WMS Server support Tiling level.

 

 

My idea is to pre-generate the tiles instead of relying on my map server (QGIS or MapServer or MapProxy, etc.)

 

I've alreay tried some test using the WMS FME Reader but I was not skill enough to achieve what I wanted to do.

 

 

Any help or hint would be appreciate :)

 

Thanks

Badge +3

Here's a workspace that should help you get started: WMSHarvester v1.0.fmw

This workspace reads a WMS url and writes out all the layers available from that WMS.

 

 

It does this by

 

1. composing a GetCapabilities request and using that to get a set of records for the available layers.

 

2. use the layer records and their properties (bbox) to compose a GetMap query to get the raster image for each layer.

 

3. write out each layer using dataset fanout on layer name

 

 

Ultimately all of this is configured by copying the WMS requests from the Data Inspector WMS reader log and breaking them up into different terms that can be replaced by attribute values or user defined parameters for the dynamic parts to build up the fetchURL. This is configured to work with the one of Safe's WMS 1.1 demo servers. Implementations vary, so you may need to adjust the message structure to fit another WMS servers specific configuration.

You can customize how the requests are composed and use other properties from the GetCapabilities response to configure your queries. Or you could use a sequence of extents requests instead of the default full extent if you want to get a higher resolution response.

Note that its up to the user to ensure that harvesting data from a given WMS does not violate terms of use. You may also want to consider using a Decelerator transformer to avoid generating too many requests at once which can appear as a DOS attack by some servers.

WMSharvester_1.0.fmw

Badge

Here's a workspace that should help you get started: WMSHarvester v1.0.fmw

This workspace reads a WMS url and writes out all the layers available from that WMS.

 

 

It does this by

 

1. composing a GetCapabilities request and using that to get a set of records for the available layers.

 

2. use the layer records and their properties (bbox) to compose a GetMap query to get the raster image for each layer.

 

3. write out each layer using dataset fanout on layer name

 

 

Ultimately all of this is configured by copying the WMS requests from the Data Inspector WMS reader log and breaking them up into different terms that can be replaced by attribute values or user defined parameters for the dynamic parts to build up the fetchURL. This is configured to work with the one of Safe's WMS 1.1 demo servers. Implementations vary, so you may need to adjust the message structure to fit another WMS servers specific configuration.

You can customize how the requests are composed and use other properties from the GetCapabilities response to configure your queries. Or you could use a sequence of extents requests instead of the default full extent if you want to get a higher resolution response.

Note that its up to the user to ensure that harvesting data from a given WMS does not violate terms of use. You may also want to consider using a Decelerator transformer to avoid generating too many requests at once which can appear as a DOS attack by some servers.

WMSharvester_1.0.fmw

Hi @deanatsafe,

Thank you very much for the workspace and the very detail explanation.

 

I will try it and I will let you know about the results !

 

Thanks again !

Hello,

 

Im in the same situation as arnaud, but it seems like i can't download your workspace "WMSharvester_1.0.fmw", is it possible for you to link it again if you happen to have it ?

 

Thanks !

Userlevel 2
Badge +14

Hello,

 

Im in the same situation as arnaud, but it seems like i can't download your workspace "WMSharvester_1.0.fmw", is it possible for you to link it again if you happen to have it ?

 

Thanks !

Hi @jiei​ 

I have fixed the link to the workspace as well as attached it to this comment for your reference.

Here's a workspace that should help you get started: WMSHarvester v1.0.fmw

This workspace reads a WMS url and writes out all the layers available from that WMS.

 

 

It does this by

 

1. composing a GetCapabilities request and using that to get a set of records for the available layers.

 

2. use the layer records and their properties (bbox) to compose a GetMap query to get the raster image for each layer.

 

3. write out each layer using dataset fanout on layer name

 

 

Ultimately all of this is configured by copying the WMS requests from the Data Inspector WMS reader log and breaking them up into different terms that can be replaced by attribute values or user defined parameters for the dynamic parts to build up the fetchURL. This is configured to work with the one of Safe's WMS 1.1 demo servers. Implementations vary, so you may need to adjust the message structure to fit another WMS servers specific configuration.

You can customize how the requests are composed and use other properties from the GetCapabilities response to configure your queries. Or you could use a sequence of extents requests instead of the default full extent if you want to get a higher resolution response.

Note that its up to the user to ensure that harvesting data from a given WMS does not violate terms of use. You may also want to consider using a Decelerator transformer to avoid generating too many requests at once which can appear as a DOS attack by some servers.

WMSharvester_1.0.fmw

What about WMTS, i want to download a specific layer from a wmts link, which is within a given polygon and to write it as geotiff. And because the area could be big, i want to tile the written geotiff by a certain row and field number, and the files to be written like filename_A1,filename_A2,filename_A3...etc based on the row and column number needed like 3x3 or 4x5, 5x5 ...based on the needs.

Hello,

Downloading all tiles from a WMS (Web Map Service) server involves:

  1. Understand the WMS server, its layers, and bounding box.
  2. Determine tile coordinates for the desired area.
  3. Construct
  4. GetMap
  5. requests with necessary parameters.
  6. Use a programming language or tools like
  7. wget
  8. to download tiles via HTTP requests.
  9. Respect server capacity and terms of service, and consider rate-limiting to avoid overloading the server.

 

Reply