If I have a WMTS URL, is it possible to feed in the URL and have it automatically add all the layers onto my map instance?

Currently, I can replicate the demo, but only if I pass in options, etc. Unfortunately, these streams are going to be dynamic and I will only be given the URL.


1 Answer 1


In a WMS this can be done by requesting the root layer, not sure about WMTS, of course it's not actually that useful, because the maps all overlay each other, so you're likely to obscure some data

So if you look at this service you can see it has six layers:

   <Title>BGS bedrock and superficial geology</Title>
   <Layer queryable="1" opaque="0" cascaded="0">
   <Layer queryable="1" opaque="0" cascaded="0">
   <Layer queryable="1" opaque="0" cascaded="0">
   <Layer queryable="1" opaque="0" cascaded="0">
   <Layer queryable="1" opaque="0" cascaded="0">
   <Layer queryable="1" opaque="0" cascaded="0">

but if you want all of them in one call you can ask for the root layer BGS_EN_Bedrock_and_Superficial_Geology like:


WMS root layer

But you can't see some of the data like the layer called BR_BGS_625k_BLT, because it is hidden beneath the others, and there's no way to discover it, because the map image is rendered on the server. It's not a case of somehow dissolving the top layers.

hidden layer

Or you can ask for multiple layers, like:


multiple layer request

but the result is similar, you get one image, though you can determine which one comes out on top.

  • Thanks for the response. The images only overlay on top of one another only if the layers overlap, no? For example, I could have Canadian layers, USA layers, etc. All independent of each others geospatial region. Commented Apr 26, 2018 at 15:36
  • Sure, so in the last example the data from three layers is visible, though one layer partially obscures the other
    – nmtoken
    Commented Apr 26, 2018 at 15:43
  • So you're saying for (WMS, not WMTS) I can query for the root layer? How exactly does that look? Commented Apr 26, 2018 at 15:45
  • The request is the second link
    – nmtoken
    Commented Apr 26, 2018 at 15:46
  • I coded up a simple example for WMS and WMTS github.com/Schachte/WMTS-Layer-Parser. This allows me to loop through all settings for each type and dynamically add the layers. Since the layers are going to be toggle-able by the client, I feel adding all of them is fine. Commented Apr 26, 2018 at 18:10

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.