AnsweredAssumed Answered

Embed Web Map Viewer on a custom application and been able to create web maps

Question asked by raul.jimenezesri-es-esridist Employee on Apr 5, 2018

Is it possible to embed the Web Map Viewer in a custom web app and enable users to create Web Maps?

 

I would like to do something similar on what you can do in several story maps (like Journal, Cascade, ...), something like this:

 

 

As you can notice the viewer is embedded and there is a "Save button" outside (for some reason the default save button isn't there when you embed the viewer).

 

So then, I downloaded the storymap-journal source code and try to do the same in localhost and I got this message:

 

 

That was disturbing, why is that? is it to avoid problem with the cookies?

 

Trying to understand how the "Save" button is implemented I opened the console and saw a debug message when I clicked it, then I checked the source code and I found the function which is called in the MapViewerWrapper.js file: 

this.send = function(json)
{
     console.log("MV sending", json);
     try {
          params.frameWindow.postMessage(JSON.stringify(json), MapViewerWrapperUtils.getPortalURL());
     } catch ( error ) {
          // This doesn't seems to be called as the error would happen in the frame
          params.onError(error );
     }
};

Debugging I check the "json" object and it contains something like:

{type: "hasUnsavedChanges"}

And the "MapViewerWrapperUtils.getPortalURL()" is returning:

"http://hhkaos.maps.arcgis.com"

I don't think it is a cross-domain issue with the postMessage, right?

 

So I just wanted to ask if any of you have tried to do what I want to do, or just know if it is possible.

 

Thanks in advance,

Raul

 

P.S: I tried two years ago when the "Save button" was still inside the iframe, but I think it was removed in one ArcGIS Online update.

Outcomes