1

I am wanting to make an "open layer" menu option, where users just need to provide an URL. I pretend to figure out which service is provided from that URL, to properly construct that layer in OL. After looking deep into OL API, I couldn't find any clue.

Is there any specific method to check it?

There are Tile, Image, Vector and VectorTile layers, each of them with their own specific sources. I am... trying to implement something like the OL drag and drop interaction for local files, that iterates all "available" formats forcing to read features until one works.

1 Answer 1

1

There is no way to find other needed parameters just from the URL.

What is usual, it to ask for a capabilities URL. Based on that, you request the capabilities document and parse it using ol.format.WMSCapabilities() or ol.format.WMTSCapabilities() for example. You can check an example.

Based on the capabilities document, you provide a list of layers. The user will select the one(s) he wants. You might also ask for other parameters, like style, image format, transparency, TileMatrix for a WMTS service, etc.

1
  • Thanks for the answer. Even with GetCapabilities it's needed to have extra input from user, as you suggested. Anyway, it can be somewhat done if the app searches for WMS, WMTS and, finally, other file formats (like KML). If finds services that need extra input, query users as needed.
    – JDA
    Commented Oct 24, 2017 at 8:55

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.