I had a look through the ESRI js API (version:3/4) and examples on ESRI's page but I couldn't find something like an "add map layers from ", where the source is any reachable map service, WMS or ESRI Map service or something else.

If I want one I build it myself?

1 Answer 1


You can simply use some JavaScript to take in the URL and create the layer and add it to the map. Something like this:

var addLayer = (url) => {
    const layer = new FeatureLayer({
      url: url 

Of course you'll have to ask the user to specify the layer type, or detect it from the pattern. Here's an example for Feature Layer only to get you started.

  • 1
    Thanks for the example, the answer then is to build one myself rather than there being a "search for/browse and add layers from this predefined/runtimedefined source" widget ready. That's all I wanted to know : ) Also I shall make sure not to write "Friendly regards" anymore.
    – David I
    Commented Aug 31, 2018 at 14:30

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.